What Is Hexadecimal? A Clear Guide to Base 16
By Shihab Mia July 18, 2026 6 min read
Quick answer
Hexadecimal is a base 16 number system that uses sixteen digits: 0 to 9 and then A, B, C, D, E, F to stand for the values 10 through 15. Because each hex digit maps to exactly 4 bits, two hex digits describe one full byte (00 to FF, which is 0 to 255 in decimal). Hex is a compact, human-readable shorthand for binary.
You have almost certainly seen hexadecimal without knowing its name. The color code FF0000 for pure red, a MAC address like 00:1B:44:11:3A:B7, or a memory address in an error report are all written in hex. This guide explains what base 16 actually means, why programmers rely on it, and how to read and convert it with confidence.
What "base 16" really means
Every number system has a base, which is simply how many distinct digits it uses before it has to carry over to a new place. Decimal, the system we count with, is base 10: it uses ten digits (0 to 9), and once you pass 9 you carry into the tens place. Binary is base 2 and uses only 0 and 1. Hexadecimal is base 16, so it needs sixteen distinct symbols.
The problem is that our everyday number symbols stop at 9. Hex solves this by borrowing the first six letters of the alphabet. So the full digit set runs 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Here A stands for ten, B for eleven, C for twelve, D for thirteen, E for fourteen, and F for fifteen. The letter F is the largest single hex digit, exactly as 9 is the largest single decimal digit.
The sixteen hexadecimal digits and their values
| Hex digit | Decimal value | 4-bit binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 7 | 7 | 0111 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Why one hex digit equals exactly 4 bits
This is the single most useful fact about hexadecimal. Four bits can represent 2 to the power of 4, which is 16 different combinations, from 0000 to 1111. Base 16 also has exactly 16 digits. That perfect match means one hex digit encodes one group of 4 bits with nothing wasted and nothing missing. A 4-bit group is called a nibble, and a nibble is literally half a byte.
Because a byte is 8 bits, and 8 bits is two nibbles, two hex digits describe one full byte. The smallest byte, 00000000 in binary, is 00 in hex and 0 in decimal. The largest byte, 11111111 in binary, is FF in hex and 255 in decimal. That is why byte values are almost always shown as a tidy two-character hex pair rather than an eight-digit run of ones and zeros.
Good to know
FF equals 255, not 256. A single byte holds 256 distinct values, but they run from 0 to 255, so the highest value is 255. Off-by-one confusion here is extremely common, so keep the range firmly in mind: 00 to FF means 0 to 255.
How hex place value works
In decimal, each place is a power of 10: ones, tens, hundreds. In hexadecimal, each place is a power of 16: ones, sixteens, two-hundred-fifty-sixes, and so on. To find a number's value, multiply each digit by its place value and add the results together.
Place values in a 4-digit hex number
| Place | Power of 16 | Decimal weight |
|---|---|---|
| 1st (rightmost) | 16^0 | 1 |
| 2nd | 16^1 | 16 |
| 3rd | 16^2 | 256 |
| 4th | 16^3 | 4096 |
A worked conversion: hex 2AF to decimal
- Line up the digits with their place values: 2 is in the 256 place, A is in the 16 place, F is in the 1 place.
- Convert each hex digit to its decimal value: 2 stays 2, A becomes 10, F becomes 15.
- Multiply by place value: 2 times 256 is 512, then 10 times 16 is 160, then 15 times 1 is 15.
- Add the parts together: 512 plus 160 plus 15 equals 687.
- So hex 2AF equals 687 in decimal. You can check any result instantly with the hex to decimal converter.
Going the other direction, from binary to hex, is even easier because you never have to do arithmetic. Split the binary number into groups of 4 bits starting from the right, then translate each nibble using the table above. For example, 1010 1111 becomes AF directly. A hex to binary tool shows the nibble pairing side by side if you want to practice the reverse mapping.
Where you actually see hexadecimal
Hex is not an academic curiosity. It appears constantly in real software and hardware because it compresses long binary values into something a person can read at a glance.
- Web and CSS colors. A color like FF0000 is three bytes: FF red, 00 green, 00 blue, giving pure red. 00FF00 is green and 0000FF is blue. Each channel runs 00 to FF, the same 0 to 255 range you get in RGB.
- Memory addresses. Debuggers and crash logs print addresses in hex, such as 0x7FFE0000, because it lines up neatly with the underlying binary layout of memory.
- MAC addresses. A network card's hardware address is six bytes shown as twelve hex digits, like 00:1B:44:11:3A:B7.
- Byte dumps and file inspection. A hex editor shows raw file bytes as hex pairs so you can inspect structure, headers, and encoding without drowning in binary.
- Character codes and escapes. Unicode code points and URL escapes use hex, for example %20 for a space or U+00E9 for the letter e with an accent.
If you work with text encodings, it helps to see how the same character can be written as a decimal code, a hex code, and raw binary. The way hex sits alongside those other systems is closely related to what ASCII is and to how the same values look when you read binary code directly.
Common mistakes to avoid
- Reading letters as their alphabet position instead of their value. In hex, A is 10 and F is 15. It is not "the first letter" in any counting sense beyond that fixed mapping.
- Confusing FF with 256. FF is 255. The value 256 needs a third digit and is written 100 in hex.
- Forgetting the 0x prefix or the # sign. Many languages write hex with a leading 0x (0xFF), and web colors use a leading # (#FF0000). Without a marker, "10" is ambiguous: it is sixteen in hex but ten in decimal.
- Case worries. Hex is not case sensitive. FF, Ff, and ff all mean the same value. Pick one style and stay consistent for readability.
- Miscounting bytes. Two hex digits are one byte. A code like FF0000 is not six bytes, it is three.
Hexadecimal next to other number systems
Hex is one of four systems you meet often in computing. Decimal is for humans, binary is what machines store, octal (base 8) is an older grouping into 3-bit chunks, and hexadecimal is the compact bridge between people and binary. If you are comparing them, it is worth reading about the octal number system to see why base 16 won out for most modern uses: 4-bit nibbles map cleanly onto 8-bit bytes, while octal's 3-bit groups do not.
The number 255 across four systems
| System | Base | Value of 255 |
|---|---|---|
| Binary | 2 | 11111111 |
| Octal | 8 | 377 |
| Decimal | 10 | 255 |
| Hexadecimal | 16 | FF |
Once base 16 clicks, hex stops looking like a wall of cryptic codes and starts reading like plain shorthand for binary. Remember the three anchors: sixteen digits ending in A to F, one digit per nibble, and 00 to FF covering 0 to 255. With those in hand you can read a color code, decode a byte dump, or convert an address in seconds, and let a converter handle the arithmetic when the numbers get long.