Binary, Decimal, Hex, and Octal: What Number Bases Actually Mean

Binary, hex, and octal aren't different "codes" for numbers -- they're the same numbers written with a different number of digits. Once you see why, converting between them (or reading them in code) stops being a memorization exercise.

A number base is just how many digits you have before you carry

Decimal (base 10) uses ten digits, 0 through 9, and carries to a new column once you hit 10. Binary (base 2) has only two digits, 0 and 1, so it carries after every single step -- that's why binary numbers look so much longer than decimal ones for the same value. Octal (base 8) uses digits 0-7, and hexadecimal (base 16) needs six extra symbols beyond 9, so it borrows A-F to represent 10 through 15.

Why hex shows up constantly in programming

Hex is popular because it maps cleanly onto binary: exactly 4 bits (one "nibble") make one hex digit, with no leftover. That's why a byte (8 bits) is always exactly 2 hex digits -- FF is 11111111, 0F is 00001111. Colors like #3B82F6, memory addresses, and MAC addresses are usually shown in hex for this reason, not because hex is inherently more "computer-like" than decimal.

Why octal shows up less than it used to

Octal has the same clean-mapping property (3 bits per digit), which is why old Unix file permissions (like chmod 755) are written in octal -- each permission group (owner, group, other) is exactly 3 bits: read, write, execute. Outside of that legacy use, octal is rare today; hex mostly won.

Converting by hand: place values, not magic

Every positional number system works the same way: each digit's value is (digit) x (base)^(position), counting position from 0 on the right. Binary 1011 is (1x8)+(0x4)+(1x2)+(1x1) = 11 in decimal. The same logic applies to hex and octal -- you're just multiplying by powers of 16 or 8 instead of 2. Doing this by hand is good for understanding it once; doing it repeatedly by hand is a waste of time you don't need to spend.

Text is numbers too

This is also why "convert text to binary" is a real, well-defined operation and not something vague: every character in a string already has a numeric code behind it (ASCII or Unicode), and that number can be written in binary, hex, or decimal exactly like any other number. "A" is 65 in decimal, 01000001 in binary, and 41 in hex -- three representations of the identical value.

Use the converters instead of doing it by hand

The Number Base Converter converts between binary, octal, decimal, and hex instantly, and the Text to Binary tool handles the character-to-binary direction specifically, converting text to binary and back.

We use cookies to understand how you use the site. No personal data is sold.

Binary, Decimal, Hex, and Octal: What Number Bases Actually Mean | Plexto