Hexadecimal Reference Chart
Hexadecimal counts in base 16 instead of the familiar base 10, using sixteen symbols — the digits 0 through 9, then the letters A through F standing in for 10 through 15 — because a normal base-10 system runs out of single digits at 9 and hex needs six more. It looks unfamiliar the first time anyone sees it, but it's built from exactly the same positional counting logic as ordinary decimal, just with a bigger base, and it exists almost entirely because it maps onto binary far more conveniently than decimal ever could.
Why Base 16, Specifically
The choice of 16 isn't arbitrary or aesthetic — it's exactly 2 to the 4th power, meaning one hex digit represents precisely four binary digits (a "nibble") with nothing left over. That clean alignment is the entire reason hex exists as a practical tool rather than a curiosity: a full 8-bit byte converts to exactly two hex digits, with no fractional remainder and no awkward rounding, which decimal simply cannot offer since 10 doesn't divide evenly into any convenient power of 2. Octal (base 8) was actually the earlier popular alternative for exactly the same reason — 8 is 2 cubed — but as computer word sizes standardized around multiples of 8 bits (bytes) rather than multiples of 3 bits, hex's cleaner two-digits-per-byte mapping won out over octal's more awkward fit.
Counting From 0 to 20 in Hex
Hex counts 0 through 9 exactly like decimal, then continues A, B, C, D, E, F for 10 through 15. The next number after F rolls the rightmost digit back to 0 and increments the next position, giving 10 — which looks like decimal ten but actually represents the value sixteen. Counting onward: 11 is seventeen, 12 is eighteen, continuing up through 1F (thirty-one), at which point the pattern rolls over again to 20 (thirty-two). Reading hex fluently mostly comes down to internalizing that each additional digit position is worth 16 times more than the one to its right, the same relationship decimal's positions have to each other, just scaled up.
Converting Decimal to Hex by Hand
Repeated division by 16, tracking the remainders, converts any decimal number to hex. Take 202: divided by 16 gives 12 remainder 10 (10 is A in hex); 12 divided by 16 gives 0 remainder 12 (12 is C in hex). Reading the remainders in reverse order (last division first) gives CA — so 202 in decimal is CA in hex. Checking the reverse direction confirms it: C is 12, worth 12 times 16 (192), plus A, worth 10, giving 192 + 10 = 202 exactly.
Where 'Hexadecimal' as a Word Actually Came From
The term itself dates to around 1950, coined to describe the base-16 notation used on the Standards Eastern Automatic Computer (SEAC), an early computer built by the US National Bureau of Standards in Maryland — and the specific choice of the digits 0-9 followed by the letters A-F, rather than some other symbol set entirely, was set by that project and simply stuck as the convention everyone since has followed. The notation gained much wider, lasting popularity roughly fifteen years later through IBM's System/360 mainframe line, announced in 1964 and documented for programmers through IBM's Fortran IV manuals around 1966 — by which point hex was thoroughly established as the standard way to represent raw byte and memory values across the computing industry, a convention that has never seriously been challenged since.
The Genuinely Common Uses of Hex Today
- Web and design color codes: a six-digit hex code like #1A2B3C packs three full byte values (red, green, blue) into a compact, copy-pasteable string — each pair of digits is one color channel's brightness from 00 (none) to FF (full).
- Memory addresses and debugging output: programmers reading a crash log or a memory dump see raw addresses and byte values in hex because it's dramatically shorter and less error-prone to read and type than the equivalent binary.
- MAC addresses: the unique hardware identifier burned into every network adapter is conventionally written as six pairs of hex digits (like 00:1A:2B:3C:4D:5E), a direct, readable stand-in for the underlying 48 raw bits.
- URL and text encoding: characters that can't appear directly in a URL are "percent-encoded" using their hex byte value, which is why a space sometimes shows up in a web address as %20 — 20 being the hex value of the ASCII space character.
Web colors also support a shorthand three-digit form (#ABC) alongside the full six-digit version, where each of the three digits is simply doubled to produce the full value — #ABC expands to #AABBCC — a small but genuinely useful convenience for the common case of flat, evenly-toned colors where the doubled-digit shortcut happens to land on exactly the right shade.
The '0x' Prefix, and Why It Exists
Written on its own, a string like 41 is genuinely ambiguous — is it decimal forty-one, or hex 41 (which equals decimal sixty-five)? Programming languages solve this with a fixed prefix convention, almost universally 0x, so 0x41 is unambiguously hex while plain 41 is assumed decimal. The prefix itself carries no numeric value; it's purely a marker, similar in spirit to how this site's binary reference explains ASCII's control codes exist purely to signal something about the data that follows rather than being data themselves.
Hex vs. Binary: When to Reach for Which
Binary is what a computer actually stores and processes at the hardware level; hex is a human-readability layer sitting directly on top of it, with a fixed, simple conversion in either direction. Nobody hand-reads long binary strings if they can avoid it — a 32-bit value is 32 individual 1s and 0s in binary but only 8 characters in hex, an easier length to visually compare, copy correctly, or spot a typo in. The two are never in real competition for the same job: binary is the actual underlying representation; hex is the shorthand a person uses to talk about it accurately without losing their place counting digits.
Hexspeak: Programmers Spelling Words in Hex
Because hex digits include the letters A, B, C, D, E and F, and because 0 reads like O, 1 reads like I, and 5 reads like S, programmers have long spelled genuine, memorable words using nothing but valid hex digits — a novelty convention with a real practical use called "hexspeak." 0xDEADBEEF is a famous example, historically used by systems including IBM's RS/6000 and older 32-bit Mac hardware as a deliberate "magic" marker value written into freshly freed or allocated memory, specifically because a programmer scanning a memory dump instantly recognizes DEADBEEF as clearly not real, meaningful data if it turns up somewhere it shouldn't. 0xCAFEBABE serves a similar recognizable-marker role as the fixed identifying value at the very start of every compiled Java class file. Other documented examples include 0xBAADF00D, used by Microsoft systems to flag uninitialized memory, and 0xDEADDEAD, historically used as a stop code in Windows NT crash conditions — each one a genuinely useful piece of engineering built entirely on hex's coincidental overlap with the Latin alphabet.
A Worked Example, Text to Hex: "GO"
G is ASCII 71, which is 47 in hex (4 sixteens plus 7 equals 71). O is ASCII 79, which is 4F in hex (4 sixteens plus 15 equals 79). "GO" converts to 47 4F — a clean, compact, two-character-per-letter representation that's considerably easier to read, type or verify correctly by eye at a glance than the equivalent eight-digit binary string for each individual character would ever be.
Frequently Asked Questions
Why do hex digits stop at F instead of continuing further into the alphabet?
Base 16 needs exactly sixteen distinct symbols, and 0 through 9 plus A through F together supplies exactly sixteen — there's no real need to go further into the alphabet, since G would represent the value 16, which is precisely where hex's own two-digit '10' notation already cleanly takes over.
Is hexadecimal used for anything other than representing computer data?
Its dominant real-world use is genuinely computing-related — memory, color codes, hardware identifiers, byte values — rather than general mathematics or everyday counting, which is why most people only ever encounter it through technology rather than through ordinary arithmetic education.
Why didn't computing standardize on octal (base 8) instead of hex, since it's also a power of 2?
Octal maps cleanly onto groups of 3 bits, but computer word and byte sizes standardized around multiples of 8 bits rather than 3, so hex's clean 4-bits-per-digit, two-digits-per-byte relationship fit the hardware that actually won out far better than octal's 3-bit grouping did.
Can negative numbers be represented in hexadecimal the same simple way as positive ones?
Not with a simple minus sign in most real computing contexts — negative numbers in actual computer hardware are typically represented using a scheme called two's complement, which noticeably changes how a negative value's hex representation actually looks compared to simply writing a minus sign in front of the positive value's hex digits.