Same Numbers, Different Costumes
Here is the same quantity written three ways: 42 in decimal, 101010 in binary, 2A in hexadecimal. Nothing about the amount changed, only the notation. A number system (a "base") is just an agreement about how many symbols you use before carrying to the next column. Humans standardised on ten symbols (blame fingers). Computers and programmers made other choices, for excellent reasons.
Decimal: Base 10, the One You Know
Ten symbols (0 to 9), and each column is worth ten times the one to its right. The number 347 unpacks as:
3×100 + 4×10 + 7×1 = 347
(hundreds) (tens) (ones)
Obvious to us, but only because we practised it since childhood. Every base works exactly this way, just with a different multiplier.
Binary: Base 2, the One Computers Are Made Of
Two symbols (0 and 1), columns worth double each step: 1, 2, 4, 8, 16, 32...
101010 = 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42
Why computers insist on it: physical reality. A transistor is on or off, a voltage is high or low, a magnetic spot points one way or the other. Two reliably distinguishable states means two symbols, and all of computing (numbers, text, images, this article) is built from those bits, grouped into bytes of 8 bits (256 possible values, 0 to 255).
Hexadecimal: Base 16, the Programmer's Shorthand
Binary is honest but exhausting: 11010110111101011001010110101010 is 32 bits of pure eye strain. Hexadecimal fixes this with sixteen symbols: 0 to 9, then A to F standing for 10 to 15.
The magic that makes hex THE binary shorthand: 16 = 2⁴, so one hex digit is exactly four bits. Conversion is pure pattern substitution, no arithmetic:
binary 1101 0110 1111 0101
hex D 6 F 5 = 0xD6F5
Cheat table:
0000=0 0001=1 0010=2 0011=3
0100=4 0101=5 0110=6 0111=7
1000=8 1001=9 1010=A 1011=B
1100=C 1101=D 1110=E 1111=F
Two hex digits = one byte, always. That clean fit is why memory dumps, color codes, and hashes are written in hex, and why decimal (whose 10 doesn't divide into powers of 2) never took the job. The 0x prefix is just a costume tag meaning "hex follows". Convert anything instantly with our free hex converter.
Where You Meet Each One
- Hex colors:
#FF6B35is three bytes: red FF (255), green 6B (107), blue 35 (53). - Hashes: A SHA-256 output is 32 bytes, written as 64 hex characters. Generate some with our hash generator and count them: the mechanics are in our hashing guide.
- MAC and IPv6 addresses:
a4:5e:60:e2:5b:11and2001:db8::1: networking lives in hex. - URL percent-encoding:
%20is a space: hex 20 = 32, the space character's byte value. Full story in our URL encoding guide. - Error codes and memory addresses: That
0x80070005in a Windows error is hex talking to you. - Binary in disguise: file permissions (chmod 755 is octal, binary's other shorthand), subnet masks, and every "raw bytes" view in a debugger.
Converting by Hand (Party Tricks Included)
Decimal to Binary: Halve and Track Remainders
42 ÷ 2 = 21 r 0
21 ÷ 2 = 10 r 1
10 ÷ 2 = 5 r 0
5 ÷ 2 = 2 r 1
2 ÷ 2 = 1 r 0
1 ÷ 2 = 0 r 1
Read remainders bottom-up: 101010
Binary to Decimal: Add the Powers
Write 128, 64, 32, 16, 8, 4, 2, 1 over the bits; add where there's a 1.
Hex to Decimal
0x2A = 2×16 + 10×1 = 42
0xFF = 15×16 + 15 = 255 (the biggest byte)
And binary↔hex needs no math at all: substitute nibbles from the cheat table above. For anything bigger, our converter tool does text, hex, binary, and decimal in every direction.
Once hex clicks, a wall of bytes stops being noise.
FFreads as "maxed out byte",00as "empty",7Fas "127, the top of ASCII". It's literacy, not math.
Frequently Asked Questions
Why 16 and not some other base for programmers?
Because 16 is a power of 2, hex digits align perfectly with 4 bit groups, and two digits equal exactly one byte. Octal (base 8, 3 bits per digit) had the job in early computing and survives in Unix permissions, but bytes being 8 bits made hex's 4+4 split the natural winner.
Is 0x2A a different number than 42?
Same number, different notation: 0x2A = 42 = 101010₂. The prefix (0x for hex, 0b for binary in many languages) only tells the reader which costume the number is wearing.
Why do file sizes sometimes use 1024 instead of 1000?
Binary strikes again: 2¹⁰ = 1024 is the power of two nearest 1000, so computing adopted it for kilobytes historically (now formally called KiB). Disk marketers use decimal 1000s, which is why your "1 TB" drive shows as 931 "GB": both are right in their own base.
What's the biggest number a byte can hold, and why do I care?
255 (0xFF, 11111111). It's why RGB color channels stop at 255, why old game counters overflowed at 255, and why IPv4 addresses have no octet above 255. The pattern repeats at every power: 65,535 for two bytes, and so on.
Are hex values ever case sensitive?
No: 0x2a and 0x2A are identical, and conventions vary (CSS colors often lowercase, Windows errors uppercase). The only place letter case matters is when hex appears inside a case-sensitive string, like a URL path or a Base64 blob, which is a different encoding entirely: see our Base64 guide for that cousin.