Free online converter

Hex Converter

Convert hexadecimal values to decimal, binary and octal or choose another input base and convert that value to hexadecimal. Results use exact integer arithmetic and can be copied instantly.

Binary101010
Octal52
Decimal42
Hexadecimal2A

Hexadecimal basics

  • Hex is base 16: digits 0–9 then A–F (A = 10 … F = 15).
  • Hex to decimal: multiply each digit by a power of 16 and add. 2A = 2 × 16 + 10 = 42.
  • One hex digit = 4 bits, two hex digits = 1 byte (00–FF = 0–255).
  • Colour codes like #FFA500 are three bytes: red, green and blue.

How to use the Hex Converter

  1. Choose the number base of the value you are entering.
  2. Enter a hexadecimal, decimal, binary or octal integer.
  3. Hexadecimal accepts 0 through 9 and letters A through F.
  4. A common 0x hexadecimal prefix or 0b binary prefix may be included.
  5. The tool converts the integer using BigInt arithmetic.
  6. The equivalent value is displayed in binary, octal, decimal and hexadecimal.
  7. Copy any result directly with its Copy button.

Reading hexadecimal

Hexadecimal is base 16. Each place is worth 16 times the place to its right, and the digits run 0 to 9 then A to F for 10 to 15. So 1F4 means 1 × 256 + 15 × 16 + 4 = 500.

Each hex digit stands for exactly four binary digits (bits), which is why programmers like it: 0xFF is the binary 1111 1111, one byte. To convert hex to binary, replace each digit with its 4-bit group from the table below; to go back, split the binary into groups of four from the right. The converter works with whole, non-negative numbers of any length and shows the result in all four bases at once.

Examples

Hex 2A to decimal

Hexadecimal 2A equals decimal 42 because 2 × 16 + 10 = 42.

Hex FF to decimal

Hexadecimal FF equals decimal 255 and binary 11111111.

Decimal 4096 to hex

Decimal 4096 equals hexadecimal 1000.

Binary 101010 to hex

Binary 101010 equals hexadecimal 2A.

Hex 1F4 to decimal

1F4 = 1 × 16² + 15 × 16 + 4 = 256 + 240 + 4 = 500.

Hex to binary digit by digit

0x3C becomes 0011 1100, because 3 = 0011 and C = 1100. In decimal that is 60.

Web colours in hex and RGB

ColourHexRGB (decimal)
Red#FF0000255, 0, 0
Green#00FF000, 255, 0
Blue#0000FF0, 0, 255
White#FFFFFF255, 255, 255
Black#0000000, 0, 0
Gray#808080128, 128, 128
Orange#FFA500255, 165, 0
Teal#0080800, 128, 128

Hex digits in decimal and binary

HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Frequently asked questions

What is hexadecimal?

Hexadecimal is a base-16 number system using digits 0 through 9 and letters A through F, where A represents 10 and F represents 15.

How do I convert hex to decimal?

Multiply each hexadecimal digit by its corresponding power of 16 and add the values.

Why is hexadecimal used in programming?

Hexadecimal represents binary values compactly. One hexadecimal digit corresponds to four binary bits, which makes byte and memory values easier to read.

Can I enter lowercase hexadecimal letters?

Yes. Lowercase and uppercase hexadecimal letters are accepted.

Does 0x mean hexadecimal?

With hexadecimal selected, an optional 0x prefix is accepted. A hexadecimal input of 0B is eleven; it is not removed as a binary prefix. Choose the matching base before pasting a prefixed value.

What is FF in decimal?

255 (15 × 16 + 15).

Can I convert negative numbers or fractions?

No. The converter accepts whole numbers of zero or more. Negative values in computing are usually stored with two's complement, which depends on the number of bits used.

Is there a limit to how large the number can be?

The converter uses exact whole-number arithmetic, so long values such as 64-bit or 128-bit numbers convert without rounding.

Related tools

More converters tools