Skip to content
PC Moment

Free tool

Hex to Decimal Converter

Convert a hexadecimal number to decimal and see the working digit by digit. Binary and octal are shown too, for numbers of any length.

Binary
–
Octal
–
Decimal
–
Hex
–

Hexadecimal (base 16) is how programmers write bytes, memory addresses, error codes and colors compactly: two hex digits always describe exactly one byte. This converter turns a hex value into decimal and shows the sum it used, so you can check the result or learn the method. The same value also appears in binary and octal.

How to use the hex to decimal converter

  1. Type or paste the hex number. A 0x prefix is optional, and spaces and underscores are ignored, so 0xDEAD_BEEF and DE AD BE EF both work.
  2. Leave Convert from set to hex. You can switch it to binary, octal or decimal at any time.
  3. Read the decimal result, along with the binary and octal forms of the same number.
  4. Check the step-by-step working under the result: each digit times its power of 16.
  5. Use the copy button next to any result to copy it.

How it works

Each position in a hex number is worth 16 times the position to its right. The letters A to F stand for the digit values 10 to 15. To convert, multiply every digit by 16 raised to its position (counting from 0 on the right) and add everything up:

decimal = dₙ × 16ⁿ + … + d₂ × 16² + d₁ × 16¹ + d₀ × 16⁰

Hex digit0–9ABCDEF
Value0–9101112131415
Position16⁰16¹16²16³16⁴
Place value1162564,09665,536

The converter does this with JavaScript’s BigInt, which stores whole numbers of any size exactly, so a 64-bit or 128-bit value converts without rounding. Fractions such as 0.8 in hex aren’t supported.

Worked examples

FF → 255

F × 16¹ + F × 16⁰ = 15 × 16 + 15 × 1 = 240 + 15 = 255. In binary that is 11111111: eight ones, one full byte.

1A3 → 419

1 × 16² + A × 16¹ + 3 × 16⁰ = 1 × 256 + 10 × 16 + 3 × 1 = 256 + 160 + 3 = 419.

0x7FFFFFFF → 2,147,483,647

7 × 16⁷ + F × (16⁶ + 16⁵ + … + 16⁰) = 7 × 268,435,456 + 15 × 17,895,697 = 1,879,048,192 + 268,435,455 = 2,147,483,647. That’s the largest signed 32-bit integer, a value you’ll see as an upper limit in many programs.

FFFFFFFFFFFFFFFF → 18,446,744,073,709,551,615

Sixteen F digits are 64 one-bits, so the result is 2⁶⁴ − 1, the largest unsigned 64-bit integer. A regular JavaScript number can’t hold this exactly; BigInt can.

Hex to decimal quick reference

HexDecimalHexDecimal
0A1080128
0F15FF255
1016100256
1F313E81,000
2F474001,024
64100FFFF65,535

Frequently asked questions

How do you convert hex to decimal?

Multiply each hex digit by 16 raised to its position, counting from 0 at the right, and add the results. For example, 1A3 = 1 × 256 + 10 × 16 + 3 × 1 = 419.

What is FF in decimal?

FF is 255: 15 × 16 + 15 × 1. It is the largest value that fits in one byte, which is why it shows up so often in color codes and byte dumps.

What do the letters A to F mean in hex?

They are the digits for ten to fifteen: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Upper and lower case mean the same thing.

What does 0x mean in front of a number?

0x marks a number as hexadecimal in JavaScript, C, Java, Python and many other languages. The converter accepts values with or without it.

Can it convert very large hex numbers?

Yes. It uses JavaScript's BigInt type, so 64-bit values such as FFFFFFFFFFFFFFFF (18,446,744,073,709,551,615) and longer convert exactly. It works with whole numbers only, not hex fractions.

Related guides

PC Moment title card for Binary to Decimal Converter

Free tool

Binary to Decimal Converter

Convert a binary number to decimal and see which powers of 2 add up to the result. Hex and octal are shown too.

Free calculator

PC Moment title card for Decimal to Binary Converter

Free tool

Decimal to Binary Converter

Convert a decimal number to binary with the repeated division by 2 shown, pad it to 8, 16, 32 or 64 bits, and see negative numbers in two's complement.

Free calculator

PC Moment title card for Hex to RGB Converter

Free tool

Hex to RGB Color Converter

Turn a hex color code into rgb(), rgba() and hsl() values with a color preview, or enter red, green and blue to get the hex code.

Free calculator

Free Developer and PC Tools

Free formatters, decoders and converters for developers and PC users. Everything runs in your browser, and nothing you type is sent anywhere.

2 min read