Hexadecimal Converter

Convert hexadecimal (base 16) to decimal and decimal to hex instantly, including negative numbers, two's complement for 8, 16, 32 and 64 bits, and numbers of any size.

  • 100% free
  • No signup
  • Runs in your browser

Overview

Type in either field and the other one updates as you type. Hex accepts an optional 0x prefix or h suffix; decimal numbers can be negative.

Two’s complement (signed integers)

Size Hexadecimal Signed decimal
8-bit — —
16-bit — —
32-bit — —
64-bit — —

How to use

  1. To convert hex to decimal, type the hex number in the Hexadecimal field, for example FF, 0xFF or 0FFh.
  2. To convert decimal to hex, type a whole number in the Decimal field. Negative numbers such as -1 are allowed.
  3. Read the result in the other field. The table below it shows the same value as a signed 8-, 16-, 32- and 64-bit integer in two's complement.

How hexadecimal works

Hexadecimal is a base-16 number system. 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 position is worth 16 times the position to its right.

Programmers use hex because one hex digit stands for exactly four bits, so a byte is always two hex digits (00 to FF). Colors such as #FF8800, memory addresses and character codes are usually written in hex.

To convert hex to decimal, multiply each digit by 16 raised to the power of its position, counting from 0 on the right, and add the results. For 2F3: 2 × 16² + 15 × 16 + 3 = 512 + 240 + 3 = 755.

To convert decimal to hex, divide by 16 again and again and write down the remainders from last to first. 755 ÷ 16 = 47 remainder 3, 47 ÷ 16 = 2 remainder 15 (F), 2 ÷ 16 = 0 remainder 2, so 755 = 2F3.

Common hex values

Value Hexadecimal = decimal
Largest one-byte value (8 bits) FF = 255
Largest 16-bit value FFFF = 65535
Largest 32-bit value FFFFFFFF = 4294967295
The number 16 10 = 16
The number 100 64 = 100

Computers store negative integers in two's complement: the stored value is 2ⁿ plus the negative number, where n is the number of bits. That is why -1 is FF in 8 bits, FFFF in 16 bits and FFFFFFFF in 32 bits, and -2 is FE, FFFE and FFFFFFFE.

Examples

Example Result
Hex FF to decimal 15 × 16 + 15 = 255
Hex 0x1A3 to decimal 1 × 256 + 10 × 16 + 3 = 419
Decimal 1000 to hex 3 × 256 + 14 × 16 + 8 = 3E8
Decimal -1 to hex (32-bit) FFFFFFFF
Tips: Hex is often written with a 0x prefix (e.g. 0xFF).

FAQ

Hex uses 0-9 and A-F; A=10, B=11, up to F=15.

Multiply each digit by a power of 16 and add the results. For example, 7B = 7 × 16 + 11 = 123. Or type the hex value into the converter above.

It only marks a number as hexadecimal, as in 0xFF, and does not change its value. Some assemblers use an h suffix instead (0FFh). The converter accepts both.

In two's complement it is FF in 8 bits, FFFF in 16 bits, FFFFFFFF in 32 bits and FFFFFFFFFFFFFFFF in 64 bits. Written as a plain signed number it is simply -1.

No. ff, FF and Ff are the same number. The converter shows results in uppercase.

There is no practical limit. The converter uses exact big-integer arithmetic, so even 30-digit numbers convert without rounding.

Need another tool?

Explore all 61 free tools: calculators, converters, date and time tools, random generators and text utilities.

Browse all tools