Skip to content
Hex Calculator

What Is Hexadecimal?

A plain-language guide to hexadecimal (base 16) — what it is, why computing uses it, and how it relates to binary and decimal.

Illustration for the guide What Is Hexadecimal: the phrase Base 16 in large type.
Hexadecimal is base 16: sixteen digits per position instead of ten.

The Short Answer

Hexadecimal — hex, for short — is a number system with 16 possible digits per position, instead of the 10 you're used to in decimal. It uses 0-9 the same way decimal does, then extends with the letters A through F to represent the values 10 through 15. So counting in hex goes 0, 1, 2, ..., 9, A, B, C, D, E, F, then rolls over to 10 (which is 16 in decimal) — the same way decimal rolls over from 9 to 10.

That's really the whole idea. Everything else — how conversions work, why it's useful, where you'll see it — follows from that one fact: hex just has more digits available per position than decimal does.

Why Base 16, Specifically?

The choice of 16 isn't arbitrary — it's exactly 2⁴, which means one hex digit represents exactly 4 binary bits, no remainder. That clean relationship is the entire reason hex exists as a widely used system: it's a compact way to write binary data without actually having to read or write long strings of 1s and 0s.

A single byte (8 bits) always converts to exactly 2 hex digits, with no rounding or leftover bits to track. Try that with octal (base 8) or decimal, and the relationship gets messier — 8 bits doesn't divide evenly into octal digits (each worth 3 bits) or decimal digits at all. Hex's clean fit with binary is why it won out as the standard human-readable shorthand in computing.

How Hex Maps to Binary, One Digit at a Time

Because one hex digit is exactly 4 bits, converting between hex and binary is just a lookup — no arithmetic required, unlike converting to or from decimal.

Hex digitBinary (4 bits)Decimal value
000000
100011
701117
810008
A101010
F111115

To convert a longer binary string to hex, split it into groups of 4 bits (starting from the right) and convert each group independently using this table. 11010110 in binary splits into 1101 and 0110 — D and 6 — giving hex D6.

How Hex Is Written

Since hex digits look identical to decimal digits for 0-9, you need some signal that a number is hex and not decimal. The most common convention in programming is a 0x prefix — 0xFF, 0x2A, 0x100 — used in C, Python, JavaScript, and most other languages. Web design and CSS instead use a # prefix specifically for hex color codes, like #2563EB. Some contexts add an h suffix instead (common in assembly language), like FFh.

Where Hex Actually Shows Up

Color Codes in Web Design

Every CSS hex color (#2563EB, #FF0000) packs three bytes — red, green, and blue — into 6 hex digits, 2 per channel.

#2563EB = R:37, G:99, B:235

Memory Addresses and Debugging

Debuggers and crash reports show memory addresses in hex because it's a compact, readable way to display the large binary addresses a 32-bit or 64-bit system actually uses.

0x7FFE8A3B2000

Bitwise Flags and Masks

Low-level code uses hex constants to represent bit patterns compactly — a single hex digit unambiguously shows which of 4 bits are set, unlike decimal.

0x0F selects the low nibble

Further reading: Hexadecimal — Wikipedia

Frequently Asked Questions

Is hexadecimal harder to learn than binary or decimal?

Not really — it follows the exact same positional logic as decimal, just with 16 possible digits per position instead of 10. The only new thing to learn is that A-F stand in for 10-15.

Do I need to memorize hex-to-decimal conversions?

No — understanding the place-value logic (each position is worth a power of 16) is what matters. Memorizing a handful of common values (like 0xFF = 255) is useful, but a calculator handles the rest.

Why don't computers just use decimal directly?

Computer hardware is built from binary (two-state) switches, so binary is the natural representation at the hardware level — hex is a human-friendly shorthand for binary, not a competing system decimal could replace.

Is hex the same everywhere, or do different fields use it differently?

The number system itself (base 16, digits 0-9 and A-F) is universal, but notation conventions vary slightly by context — programming languages commonly use a 0x prefix, while CSS and design tools use a # prefix for colors specifically.

What Is Hexadecimal? tool preview card from Hex Calculator
Share preview: this is the card that appears when you share the What Is Hexadecimal? page on social media.