Skip to content

Hex Calculator

Convert hexadecimal to decimal or decimal to hex exactly at any size, with binary output.

Maintained by the Calcenzo team. Last reviewed September 27, 2026. Methodology

Hex Calculator

Exact for any size (BigInt). Accepts an optional 0x prefix and a leading minus sign.

A hex converter changes hexadecimal (base 16) numbers into decimal (base 10) and back. Formula: hex2dec: parseInt(value, 16). dec2hex: n.toString(16).toUpperCase(). Hex 3E8 equals 1,000, and FF equals 255.

hex converter
Hex converter chart: hex values with decimal and binary equivalents.

How to use the hex converter

  1. Choose hex to decimal or decimal to hex.
  2. Enter the value, with or without a 0x prefix.
  3. Read the result and its binary form.

How the hex converter works

Hexadecimal, or hex, is base 16. It uses the digits 0–9 and the letters A–F, where A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Each place is worth 16 times the place to its right. The hex converter turns hex into decimal and decimal into hex:

  • Hex to decimal: multiply each digit by 16 raised to its position (counting from 0 on the right) and add.
  • Decimal to hex: divide by 16 repeatedly and read the remainders from last to first.

Hex converter worked example

To convert 3E8 to decimal: 3 × 16² + 14 × 16¹ + 8 × 16⁰ = 768 + 224 + 8 = 1,000. To convert 1,000 back to hex: 1,000 ÷ 16 = 62 remainder 8; 62 ÷ 16 = 3 remainder 14 (E); 3 ÷ 16 = 0 remainder 3. Reading the remainders upward gives 3E8.

Hex Decimal Binary
9 9 1001
A 10 1010
F 15 1111
10 16 10000
1F 31 11111
64 100 1100100
FF 255 11111111
100 256 100000000
3E8 1000 1111101000
FFFF 65535 1111111111111111

Why programmers use hex

One hex digit stands for exactly four binary digits (bits), so hex is a compact way to write binary. The byte 11111111 is FF in hex and 255 in decimal. Splitting a binary number into groups of four from the right and converting each group gives the hex value directly, which is why the hex converter also shows the binary form.

Very large numbers

Ordinary JavaScript numbers lose precision above 9,007,199,254,740,991 (2⁵³ − 1), as MDN explains. The hex converter uses BigInt arithmetic, so it converts values of any length exactly; FFFFFFFFFFFFFFFF becomes 18,446,744,073,709,551,615, the largest unsigned 64-bit value.

Input rules

  • Letters can be upper or lower case; ff and FF are the same.
  • An optional 0x prefix is accepted, and spaces or underscores are ignored.
  • A leading minus sign gives a negative value. The tool does not interpret two’s complement, so FF is always 255, never −1.
  • Invalid characters such as G or a decimal point are rejected instead of being silently skipped.

Hex in web colors and memory

Web colors are the place most people meet hex. A color such as #FF8800 is three pairs of hex digits for red, green and blue, so FF is 255 red, 88 is 136 green and 00 is 0 blue. Each pair runs from 00 to FF, giving 256 levels per channel and about 16.7 million colors. Programmers also see hex in memory addresses, error codes and file signatures, because two hex digits describe exactly one byte. A 32-bit value always fits in eight hex digits, and a 64-bit value in sixteen.

When you copy a value from code, you may see a 0x prefix, an h suffix or a # sign. Remove the h suffix or # sign before converting; the 0x prefix is accepted as is.

Checking results by hand

For short values you can check the hex converter by hand. Write the powers of 16 above the digits from right to left: 1, 16, 256, 4,096, 65,536. Multiply each digit by its power and add. For decimal to hex, the largest power of 16 that fits tells you how many digits the answer has; 1,000 is at least 256 but less than 4,096, so it needs three hex digits. The hex converter does the same steps instantly and never drops a digit on long values.

Why letters stand for numbers

Base 16 needs sixteen single symbols, but our everyday digits stop at 9, so the letters A to F fill the gap. That means a value like 10 in hex is sixteen, not ten. When reading code, check for a prefix or context before assuming a number is decimal.

Related calculators:

Sources

MDN Web Docs: BigInt; MDN Web Docs: Number.MAX_SAFE_INTEGER.

Formula and method

BigInt('0x' + hex) – exact for any size

BigInt arithmetic, so values of any length convert exactly. Accepts an optional 0x prefix and a leading minus sign; invalid characters are rejected.

Questions about this calculator

What is FF in decimal?

255.

What is 1000 in hex?

3E8.

What does 0x mean?

It marks a number as hexadecimal.

Why use hex?

Each hex digit equals four bits, so it is a short way to write binary.

Can it convert huge numbers?

Yes, it uses BigInt so results are exact.

Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.

Report a calculation issue