HexDecimal

Digits 0–9 and A–F, with or without 0x

Try
Decimal
687
Binary 10 1010 1111 · Octal 1257

Digit by digit

Each digit times its power of 16
DigitValuePlace valueDigit × placeBits
22162 = 2562 × 256 = 5120010
A10161 = 1610 × 16 = 1601010
F15160 = 115 × 1 = 151111

512 + 160 + 15 = 687

Signed and unsigned

The value in 8, 16, 32 and 64-bit registers
WidthHex patternUnsignedSigned
8-bit—Too large for 8 bits
16-bit02AF687687
32-bit0000 02AF687687
64-bit0000 0000 0000 02AF687687
Guide

How to convert hex to decimal

  1. Write the place values under the digits, starting from the right: 1, 16, 256, 4,096, each 16 times the last.
  2. Replace any letters with their values: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
  3. Multiply each digit by its place value and add the results. 2AF is 2 × 256 + 10 × 16 + 15 × 1 = 687.

Worked example

Converting 0x2AF to decimal:

DigitValuePlace valueResult
22162 = 256512
A10161 = 16160
F15160 = 115

512 + 160 + 15 = 687

  • Hex isn't case-sensitive: 2af and 2AF are both 687.
  • Two hex digits make one byte, so FF is 255, the largest value a byte can hold.
  • Going the other way? Use the decimal to hex converter.

Hex digits in binary

4 bits per digit
HexBinaryDecimal
000000
100011
200102
300113
HexBinaryDecimal
401004
501015
601106
701117
HexBinaryDecimal
810008
910019
A101010
B101111
HexBinaryDecimal
C110012
D110113
E111014
F111115
Learn

Hex to decimal conversion explained

Place values, a faster shortcut, signed values and the hex numbers worth knowing.

A hex to decimal converter turns a hexadecimal number, like 2AF or 0xFF, into the ordinary base-10 number it stands for. Type any hex value above and you'll get the exact decimal result, the value of every digit, and how the same bits read as a signed number. Here's how hex to decimal conversion works by hand, a faster shortcut, and the values worth knowing by heart.

What the digits A to F mean

Hexadecimal is base 16, so it needs sixteen digits. After 0 to 9 it uses letters: A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. A single hex digit therefore covers the values 0 to 15, which is exactly what four bits can hold. That's why programmers use hex as shorthand for binary, and why converting hex to decimal comes up so often when you read code, memory dumps or color values.

Converting hex to decimal with place values

Each position in a hex number is worth 16 times the one to its right. From the right, the place values are 1, 16, 256, 4,096, 65,536 and so on, the powers of 16. To convert, multiply each digit by its place value and add up the results. For 2AF, the 2 sits in the 256s place, the A (10) in the 16s place and the F (15) in the ones place. That's 2 × 256 + 10 × 16 + 15 × 1, or 512 + 160 + 15, which is 687. The Digit by digit table in the converter does exactly this for any hex number you type.

A faster method: multiply by 16 and add

For long numbers there's a shortcut that avoids working out big powers of 16. Start with the first digit. Then, for each digit after it, multiply your running total by 16 and add the digit. For 2AF: start with 2, then 2 × 16 + 10 = 42, then 42 × 16 + 15 = 687. You get the same answer with smaller numbers at every step, which makes it the easier method for mental arithmetic and the one most programs use.

Common hex values in decimal

HexDecimalWhy it matters
FF255Largest value of one byte
100256One more than a byte can hold
3E81,000—
FFFF65,535Largest 16-bit value
1000065,53616⁴
7FFFFFFF2,147,483,647Largest signed 32-bit integer
FFFFFFFF4,294,967,295Largest unsigned 32-bit integer

A useful pattern: a hex number made of n F's is always 16ⁿ − 1, the largest value that fits in that many digits.

Signed hex values

The converter gives the plain, unsigned value of your hex number. Inside a computer, though, the same bits can also be read as a signed integer using two's complement, where the top bit counts as negative. In 32 bits, FFFFFFFF is 4,294,967,295 unsigned but −1 signed, and 80000000 is −2,147,483,648. A quick check: if a full-width value starts with a digit from 8 to F, its signed reading is negative. The Signed and unsigned table shows both readings at 8, 16, 32 and 64 bits, and the two's complement calculator explains why.

Where you'll convert hex to decimal

  • Colors. A color like #FF8000 is three hex bytes. Converting each pair gives red 255, green 128 and blue 0. The RGB to hex converter does both directions.
  • Unicode. Code points are written in hex, so U+00E9 (é) is character 233.
  • Error codes and addresses. Windows error codes, memory addresses and register values are usually shown in hex, while documentation and calculations often need decimal.
  • Network and file data. Packet captures and hex editors show bytes in hex, two digits per byte.

Hex to decimal in code

Most programming languages convert hex to decimal in a single call. In JavaScript, parseInt("2AF", 16) returns 687, and so does Number("0x2AF"). In Python, int("2AF", 16) gives 687, and a literal like 0x2AF is already a number. Watch out for size limits: JavaScript numbers lose precision above 2⁵³, so very long hex values need BigInt("0x…"). This converter uses exact arithmetic, so it's a handy way to check a result. You can also check through binary: 2AF is 0010 1010 1111, and 1010101111 is 512 + 128 + 32 + 8 + 4 + 2 + 1 = 687.

Practical notes

  • A 0x prefix is fine, and spaces or underscores between digits are ignored, so 0xDEAD_BEEF works.
  • There's no size limit. Long values convert exactly, without the rounding you'd get in a spreadsheet.
  • To see the bits as well, use the hex to binary converter, or the hex converter for decimal, binary, octal and text at once.

A handy check: a hex number's value is always less than 16 to the power of its length, so any 4-digit hex number is below 65,536 and any 8-digit one is below 4,294,967,296.

FAQ

Frequently asked questions

Quick answers about the hex to decimal converter and how it works.

How do I convert hex to decimal?

Multiply each digit by its power of 16 and add the results, with A to F counting as 10 to 15. 2AF is 2 × 256 + 10 × 16 + 15 × 1 = 687. Type any hex number into the converter and the Digit by digit table shows every step.

What is FF in decimal?

FF is 15 × 16 + 15 = 255, the largest value of one byte. Likewise FFFF is 65,535 and FFFFFFFF is 4,294,967,295.

What do the letters in a hex number mean?

Hex needs sixteen digits, so after 0 to 9 it uses A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Case doesn't matter: ff and FF are the same number.

Why is FFFFFFFF shown as −1?

As an unsigned number, FFFFFFFF is 4,294,967,295. Read as a signed 32-bit integer in two's complement, the top bit counts as negative, so it's −1. The converter shows the unsigned value as the result and both readings in the Signed and unsigned table.

How do I convert a hex color to decimal?

Split the color into three pairs and convert each one. #FF8000 is FF, 80 and 00, or red 255, green 128 and blue 0. The RGB to hex converter does this for you in both directions.

Is there a limit on how long the hex number can be?

No. The converter uses exact integer arithmetic, so even very long values convert without rounding. A 0x prefix, spaces and underscores are all accepted.

Still have a question?Contact us