Tools
EN

What Is Hexadecimal?

Hexadecimal, or hex, is the base-16 number system. It writes numbers with 16 symbols – 0–9 and A–F – and is the standard shorthand for binary data in computing, from web colors to memory addresses.

Hexadecimal in one sentence

Hexadecimal is a positional number system with base 16: each digit is worth 16 times more than the digit to its right, and the values 10 to 15 are written with the letters A to F. To show that a number is hex, programmers write 0x1A (C, Java, JavaScript, Python), #1A2B3C for CSS colors, 1Ah in assembly or 1A₁₆ in mathematics.

Hex digits from 0 to 15

DecimalHexBinaryDecimalHexBinary
000000881000
110001991001
22001010A1010
33001111B1011
44010012C1100
55010113D1101
66011014E1110
77011115F1111

Counting in hex

Hex counts like decimal but carries over after F instead of after 9: … 8, 9, A, B, C, D, E, F, 10, 11 … 19, 1A … 1F, 20 … FF, 100. Here 10 means sixteen and 100 means 16 × 16 = 256. Two hex digits cover one byte (00–FF = 0–255), four digits go up to FFFF = 65,535 and eight digits up to FFFFFFFF = 4,294,967,295.

Why computers use hexadecimal

Computers store everything in binary, but long rows of 0s and 1s are hard for people to read and easy to mistype. Because 16 = 2⁴, one hex digit stands for exactly four bits (a nibble) and two hex digits for one byte. Converting between hex and binary is a simple digit-by-digit lookup, and hex is four times shorter: 1101 1110 1010 1101 is just DEAD. Decimal has no such neat relationship with binary, which is why it is rarely used for raw data.

Converting hex to decimal and back

Our converters do all of this instantly and show every step.

Where hexadecimal is used

Hexadecimal, decimal, octal and binary compared

SystemBaseDigits255 is writtenTypical use
Binary20–111111111Hardware, bit flags
Octal80–7377Unix file permissions (chmod 755)
Decimal100–9255Everyday numbers
Hexadecimal160–9, A–FFFBytes, colors, addresses, hashes

Negative numbers in hex

Hex itself has no special sign, so negative numbers are usually stored in two's complement: the highest bit of a fixed-size value marks it as negative. As a signed byte, 7F is 127, 80 is −128 and FF is −1; as a 32-bit integer, FFFFFFFF is −1. In math and in our calculator you can also simply write a minus sign: −1A = −26.

Frequently asked questions

Why does hexadecimal use letters?

Base 16 needs sixteen single-character digits, but there are only ten numerals. The letters A–F stand for the values 10–15. Uppercase and lowercase mean the same: ff = FF = 255.

What does 0x mean in front of a number?

It marks the number as hexadecimal in C, C++, Java, JavaScript, Python and many other languages: 0x10 is 16, not ten. CSS uses # for colors instead, and assembly code often adds a trailing h (10h).

Is hexadecimal the same as Base64?

No. Hex writes every byte as two characters from 0–9 and A–F, so data doubles in size but stays easy to read byte by byte. Base64 uses 64 characters and packs 3 bytes into 4 characters, which is more compact (about 33% overhead) but not readable per byte.

Updated: