↑ ↓ to moveEnter to openEsc to close

Hex to decimal converter

Type a hex number and see its decimal value along with the sum of digits times powers of 16 that produces it. Flip the signed toggle to read it as two’s complement.

  • Decimal
  • Binary
  • Octal

Bulk: one hex number per line
 

Digit by digit

Place value in base 16

Decimal numbers are built from powers of 10: 2,019 means 2 × 1000 + 0 × 100 + 1 × 10 + 9 × 1. Hexadecimal works the same way with powers of 16. From the right, the places are worth 1, 16, 256, 4,096, 65,536 and so on, each sixteen times the last.

The sixteen digits are 0 to 9 followed by A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

To convert, multiply each digit by its place value and add up the results.

Example: 7E3

DigitValuePlaceProduct
7716² = 2561,792
E1416¹ = 16224
3316⁰ = 13
Total2,019

The tool builds this table for any input, up to numbers far larger than a calculator can hold. It uses JavaScript's BigInt, so a 40-digit hash converts exactly instead of losing precision after about 16 digits.

Handy values to remember

HexDecimalWhere you see it
FF255max of one byte; one RGB channel
100256number of values in a byte
3E81,000
FFFF65,535max unsigned 16-bit value; highest TCP/UDP port
1000065,536
7FFFFFFF2,147,483,647max signed 32-bit integer
FFFFFFFF4,294,967,295max unsigned 32-bit integer
DEADBEEF3,735,928,559classic debug fill pattern
1FFFFFFFFFFFFF9,007,199,254,740,991largest integer a JavaScript Number holds exactly

Signed values and two's complement

Computers store negative integers in two's complement. In a fixed width, the top bit acts as a sign. If it is 1, the number is negative, and its value is the unsigned reading minus 2 to the power of the width.

Tick Read as signed and pick a width to see this:

  • FF at 8 bits: 255 − 256 = −1
  • 80 at 8 bits: 128 − 256 = −128, the most negative 8-bit value
  • 7F at 8 bits: top bit is 0, so it stays 127
  • FFD6 at 16 bits: 65,494 − 65,536 = −42

The same digits mean different numbers depending on width. FF is −1 as an 8-bit value but 255 at 16 bits, where the top bit is 0. When reading a register dump or a network packet, check the width in the spec before interpreting the sign.

Accepted input

  • With or without a 0x prefix: 0x1A4 and 1A4 both give 420.
  • Upper or lower case.
  • Spaces and underscores as separators, as in DEAD_BEEF or FF FF. They are stripped before converting.
  • A leading minus sign for a plainly negative hex value: -FF is −255. This is not two's complement, just a negative number written in base 16.

Anything else, such as a G or a stray letter O, is flagged rather than silently dropped.

Bulk lists

Open Bulk and paste one value per line, for example a column copied from a log file or a spreadsheet. Each line is converted on its own and invalid lines are labeled, so the output still lines up with your input when you paste it back.

Where hex-to-decimal shows up

  • Colors. Each pair in a HEX color code is a byte, so #D9481C is 217, 72, 28. The HEX to RGB converter does that split for you.
  • Memory addresses and offsets in debuggers and crash logs.
  • Error codes such as Windows HRESULTs (0x80070005 is 2,147,942,405 unsigned, or −2,147,024,891 as a signed 32-bit value).
  • Unicode code points: U+00E9 (é) is 233.
  • File formats and checksums viewed in a hex editor.

The reverse conversion, with the division method shown, is decimal to hex. For arithmetic and bitwise operations on hex values, use the hex calculator. To see the bit pattern, try hex to binary.

FAQ

Why does my calculator give a different answer for long hex numbers?

Most calculators and spreadsheets use 64-bit floating point, which is exact only up to 2⁵³. Beyond that the last digits are rounded. This tool uses arbitrary-precision integers, so the answer is exact at any length.

Is hex to decimal the same as hex to ASCII?

No. Hex to decimal reads the whole string as one number. Hex to ASCII reads it two digits at a time as character codes. For that, use the hex to text converter.

What does the "h" suffix mean, as in 7E3h?

It's an older notation for hex used in assembly language and some datasheets. Remove the h before pasting.