Skip to content
Aarrange

Hex to Decimal

Paste hex numbers, one per line, with or without 0x. Get exact decimal values and the steps. Nothing leaves your browser.

Also: All bases, Dec to Hex, Bin to Dec, Dec to Bin, Hex to Bin, Bin to Hex

0
Numbers
0
Max bits
0
Errors
Input
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About Hex to Decimal

Updated

Hex to Decimal turns hexadecimal numbers into ordinary decimal numbers. Paste one, or a whole list from a log, a crash dump or a spreadsheet. Each line is converted, exact to the last digit, and a line with a typo is marked at the bad character.

It reads hex as programmers write it: 0x80070005, #FF5733, 0FFh, upper or lower case, with spaces or underscores between digit groups. Set Signed to read error codes and register values as negative numbers.

The same tool, set up for other bases: Decimal to Hex, Binary to Decimal, Decimal to Binary, Hex to Binary, Binary to Hex, Number Base Converter.

How to use it

  1. Paste hex numbers, one per line, or load a file. Commas, tabs and semicolons also split a line, so a column from a spreadsheet works.
  2. Check From and To, next to Convert. On a phone they are under More.
  3. Press Convert (Alt C). Results shows every number in the To base and in decimal, hex, binary and octal. Output shows only the answers, line for line, for Copy and Download.
  4. Open Steps to see the math for one number, the way you would do it on paper.
  5. Swap (Alt S) puts the answers in the editor and turns From and To around, so you can check the way back.
  6. In Options: Signed for two's complement, Groups for 1111 0000 or 4,294,967,295, Prefix for 0x, 0b or 0o, and how many digits a fraction gets.

How to convert hex to decimal by hand

Hex is base 16. Each place counts 16 times more than the place to its right. Write the place values over the digits, multiply, and add:

Hex to decimal
Hex 7DE

Digit   Value   Place          Counts
  7       7     16² = 256      7 × 256 = 1792
  D      13     16¹ =  16     13 × 16  =  208
  E      14     16⁰ =   1     14 × 1   =   14
                                       ------
                                         2014

For a long number, work from the left: start at 0, then for each digit multiply what you have by 16 and add the digit. The result is the same, with smaller sums.

Hex digits and powers of 16

Hex digits
Hex  Decimal  Binary      Hex  Decimal  Binary
 0      0     0000         8      8     1000
 1      1     0001         9      9     1001
 2      2     0010         A     10     1010
 3      3     0011         B     11     1011
 4      4     0100         C     12     1100
 5      5     0101         D     13     1101
 6      6     0110         E     14     1110
 7      7     0111         F     15     1111
Powers of 16
16⁰ = 1                    16⁴ = 65,536
16¹ = 16                   16⁵ = 1,048,576
16² = 256                  16⁶ = 16,777,216
16³ = 4,096                16⁷ = 268,435,456
FF = 255   FFFF = 65,535   FFFFFFFF = 4,294,967,295

Negative numbers and two's complement

Hex from a register or an error code is often two's complement, where the top bit makes the number negative. Set Signed to its width: FF is -1 at 8-bit, and 80000000 is -2147483648 at 32-bit.

How two's complement works, with a table and the method by hand.

Exact for big numbers

Hex IDs and hashes are often 64 or 128 bits. This tool uses BigInt, so FFFFFFFFFFFFFFFF gives 18446744073709551615, not the rounded 18446744073709552000.

Why other converters round past 2^53.

Common errors

A letter that is not hex

Hex uses 0 to 9 and A to F. A G or a Z often comes from a typo, or from a number in another base. The tool marks the letter and says which base would have it.

Invalid
1A3G5
G is not a hex digit. Hex uses 0 to 9 and A to F. Remove the G,
or set From to base 17 or more.
Fixed
1A3F5

Two of the most visited converters do not stop here. One cuts the number at the G and answers 419; the other drops the G and answers 6709. Both give a number with no word of warning.

The letter O for a zero

Typed by hand, a capital O and a zero look the same. The tool names the letter, so you know what to type.

Invalid
12O4
The letter O is not a digit. Type the digit 0 (zero) in its place.
Fixed
1204

Two numbers on one line

Spaces inside a number are digit groups: 1111 0000 is one number. When the groups are not the same size, the tool still reads one number but marks the line, because it may be a list.

Warning
FF 1A 7
Read as one number, FF1A7. If these are separate numbers, put each on
its own line or split them with commas.
Fixed
FF, 1A, 7

Most converters glue two lines into one number with no warning: 1F on one line and 2A on the next become 1F2A, which is 7978.

A number too big for its bits

With Signed set to a width, every number must fit in it. 8 bits are two hex digits, so a third digit is too many.

Invalid
1FF (Signed: 8-bit)
1FF does not fit in 8 bits. 8 bits hold up to FF in hex.
Pick a wider Signed setting, or set it to Off.

Hex to decimal in code and Excel

Hex to decimal
JavaScript  parseInt("ff", 16)                 // 255
            BigInt("0xffffffffffffffff")       // exact past 2^53
Python      int("ff", 16)                      # 255; "0xff" works too
C           strtol("ff", NULL, 16)             // 255, <stdlib.h>
Java        Long.parseLong("ff", 16)           // 255
            new BigInteger("ff", 16)           // any size
Excel       =HEX2DEC("FF")                     → 255

HEX2DEC takes up to 10 hex digits (40 bits), and a 10-digit number with a top bit of 1 is negative: =HEX2DEC("FFFFFFFFFF") is -1. JavaScript parseInt rounds past 2^53 and stops at the first bad character with no error.

Hex to decimal resources

  • Hexadecimal on WikipediaWhy programmers write in base 16, the prefixes in each language, and how hex maps to bits.
  • Positional notation on WikipediaHow a digit's place sets its value, in any base. The idea behind every conversion on this page.
  • MDN: parseInt()parseInt("ff", 16) reads hex in JavaScript. It stops at the first character that is not a digit, with no error.
  • MDN: BigIntWhole numbers of any size in JavaScript. This tool uses BigInt, so no number past 2^53 is rounded.
  • Python: int() with a baseint("ff", 16) reads a number in any base from 2 to 36; hex(), bin() and oct() write one.
  • Microsoft: HEX2DEC functionHex to decimal in Excel, for up to 10 hex digits. The 10th digit carries the sign.

Hex to decimal FAQ

How do I convert hex to decimal?

Multiply each hex digit by its place value and add them up. The places, from the right, are 1, 16, 256, 4096: each is 16 times the one before. A to F are 10 to 15.

For 7DE: 7 × 256 = 1792, D (13) × 16 = 208, E (14) × 1 = 14. The sum is 2014. Paste a number here and open Steps to see it done for yours.

What is FFFFFFFF in decimal?

FFFFFFFF is 4,294,967,295, the largest unsigned 32-bit number (2^32 − 1). As a signed 32-bit number it is -1: set Signed to 32-bit to read it that way.

What is FF in decimal?

FF is 255: 15 × 16 + 15. It is the largest value of one byte, which is why each part of a CSS color like #FFFFFF goes up to FF. As a signed 8-bit number, FF is -1.

What is 33 hex in decimal?

Hex 33 is 51: 3 × 16 + 3. Hex 1 is 1 and hex 9 is 9: up to 9, hex and decimal digits are the same. From 10 on they differ: hex 10 is decimal 16.

What does 0x mean in front of a number?

0x says the number is hex. It comes from C and is used in most languages: 0x1F is 31. The tool reads hex with or without it, and also #1F and the assembly form 1Fh.

How do I convert negative hex to decimal?

Negative numbers in hex are usually two's complement: the top bit makes them negative. FFFFFFFF is -1 in 32 bits, and the Windows error 0x80070005 is -2147024891. Set Signed to the width the number was stored in: 8, 16, 32 or 64 bits.

A hex number written with a minus sign, like -FF, is read as it is: -255.

Why does another converter give 18446744073709552000 for FFFFFFFFFFFFFFFF?

Because it uses JavaScript numbers, which hold only 53 bits and round the rest. The exact value is 18,446,744,073,709,551,615. This tool uses BigInt, so every digit is right at any size.

Are my numbers sent anywhere?

No. The numbers are converted in your browser, with JavaScript BigInt. Nothing is uploaded, and there are no ads or cookie walls. You can check this in your browser's network tab while you use it.