Skip to content
thecalculatorstudio

Hex to Decimal Converter (with binary and octal)

Type a number and choose its base. You get it in decimal, hexadecimal, binary and octal, and a table of each digit times its place value so you can check the working.

Last reviewed

1A3 in hexadecimal is

419

decimal

Decimal
419
Hexadecimal
1A3
Binary
1 1010 0011
Octal
643
Each digit times its place value
DigitValuePlaceProduct
11162 = 256256
A10161 = 16160
33160 = 13

1 × 256 + 10 × 16 + 3 × 1 = 256 + 160 + 3 = 419

A 0x, 0b or 0o prefix, spaces and underscores are accepted. Whole numbers of up to 64 digits are converted exactly.

How hex to decimal works

Decimal is base 10 and hexadecimal is base 16. Each digit of a number is worth its value times the place value of its position, and the place values of hex are the powers of 16, counted from 0 on the right:

Position (from the right) 0 1 2 3 4
Place value 1 16 256 4,096 65,536

Hex needs sixteen digits, so after 9 it uses letters: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

To convert, multiply each digit by its place value and add. For 1A3:

  • 1 × 256 = 256
  • A (10) × 16 = 160
  • 3 × 1 = 3
  • Total: 256 + 160 + 3 = 419

The page shows this table for any number you enter, and the same working for binary and octal.

Worked example: DEADBEEF

DEADBEEF is a well-known hex number. The digits are D (13), E (14), A (10), D (13), B (11), E (14), E (14) and F (15). Multiplying by 16⁷ down to 16⁰ gives 3,489,660,928 + 234,881,024 + 10,485,760 + 851,968 + 45,056 + 3,584 + 224 + 15, which comes to 3,735,928,559.

Common hex values

Hex Decimal
A 10
F 15
10 16
FF 255
100 256
1A3 419
FFFF 65,535
7FFFFFFF 2,147,483,647
FFFFFFFF 4,294,967,295
DEADBEEF 3,735,928,559
FFFFFFFFFFFFFFFF 18,446,744,073,709,551,615

FF is the biggest value of one byte, FFFF of two bytes, and FFFFFFFF of four. 7FFFFFFF is 2³¹ − 1, the largest value of a signed 32-bit integer, and the 16-digit FFFFFFFFFFFFFFFF is 2⁶⁴ − 1.

Decimal to hex

Divide by 16 repeatedly and keep the remainder each time. Read the remainders from last to first.

419: 419 ÷ 16 = 26 remainder 3; 26 ÷ 16 = 1 remainder 10 (A); 1 ÷ 16 = 0 remainder 1. Reading upwards gives 1A3, the number we started with.

Hex and binary

Because 16 = 2⁴, each hex digit corresponds to exactly four binary digits. 1 = 0001, A = 1010 and 3 = 0011, so 1A3 = 1 1010 0011 in binary. This is why hex is the usual shorthand for binary. The binary calculator does arithmetic on the bits, and the hex calculator does arithmetic on the hex digits.

Octal

Octal is base 8, with the digits 0 to 7. 777 in octal is 7 × 64 + 7 × 8 + 7 = 511. It groups bits in threes, and is still used for Unix file permissions. Choose octal under “Convert from” to convert it.

Common mistakes

  • Reading letters as something else. A to F are numbers, 10 to 15, not variables.
  • Using the wrong powers. The place values are powers of 16 (1, 16, 256), not of 10.
  • Counting positions from 1. The rightmost digit is position 0, worth 16⁰ = 1.
  • Reading 10 as ten. In hex, 10 is sixteen.
  • Typing a prefix as part of the number. 0x, 0b and 0o are accepted, but # (as in colour codes) is not part of the number: type FF8000, not #FF8000.

How it is calculated

The number is read digit by digit in the base you chose and held as an exact whole number, with up to 64 digits. Each digit is multiplied by its place value (the base to the power of its position) and the products are added, which is the table shown. The same number is then written out in binary, octal, decimal and hexadecimal. Nothing goes through floating point, so no digits are lost.

Frequently asked questions

How do you convert hex to decimal?

Multiply each digit by 16 raised to its position, counting from 0 on the right, and add the results. For 1A3: 1 × 256 + 10 × 16 + 3 × 1 = 256 + 160 + 3 = 419. The letters A to F count as 10 to 15.

How do you convert decimal to hex?

Divide by 16 again and again, keeping the remainders, and read them from last to first, with 10 to 15 written as A to F. For 419: 419 ÷ 16 = 26 remainder 3; 26 ÷ 16 = 1 remainder 10 (A); 1 ÷ 16 = 0 remainder 1. Reading upwards: 1A3.

How do you convert hex to binary?

Write each hex digit as four bits and join them: 1 is 0001, A is 1010 and 3 is 0011, so 1A3 is 1 1010 0011 once the leading zeros are dropped. The reverse, binary to hex, groups the bits in fours from the right.

What is 0xFF in decimal?

255. F is 15, so FF is 15 × 16 + 15. It is the largest value a byte (8 bits) can hold. FFFF is 65,535 and FFFFFFFF is 4,294,967,295.

Is hexadecimal case sensitive, and what does 0x mean?

No. FF and ff are the same number. The 0x in front is only a marker used in programming to say that what follows is hex. This converter accepts it, and 0b for binary and 0o for octal, but you do not need it.

How large a number can it convert?

Up to 64 digits in the base you choose, so a 64-digit hex number (256 bits) converts exactly. It uses exact whole-number arithmetic, not floating point, so large numbers are not rounded. It does not convert fractions such as 1A.8.

Related calculators

Sources