GoToolsOnline Blog How-To All Tools

Hex, Binary, and Decimal: How Number Bases Work

Why 255, FF, and 11111111 are the same number — and why programmers keep talking in powers of two.

By Ben Praveen J · June 1, 2026

The number 255, the text FF, and the digits 11111111 all describe the same quantity. They look completely different because each is written in a different base — decimal, hexadecimal, and binary. If you have ever wondered why colours in CSS look like #FF8800, why a file permission is 755, or why programmers keep talking in powers of two, this is the article that makes it click.

What a “base” actually means

A base is simply how many distinct digits a number system uses, and therefore the value of each position. We use base 10 (decimal) because we have ten fingers: digits 0–9, and each position is worth ten times the one to its right — ones, tens, hundreds, thousands. Change the base and you change two things: the set of available digits, and the multiplier per position.

  • Binary (base 2) uses only 0 and 1. Each position is worth twice the previous: 1, 2, 4, 8, 16, …
  • Decimal (base 10) uses 0–9. Positions: 1, 10, 100, 1000, …
  • Hexadecimal (base 16) uses 0–9 then A–F (A=10, B=11, … F=15). Positions: 1, 16, 256, 4096, …

Why computers think in binary

A computer is built from switches that are either off or on — 0 or 1. That is binary at the physical level. Every number, letter, image, and instruction is ultimately a pattern of those two states. Eight of these bits make a byte, which can represent 256 different values (0 to 255). That “256” is why so many limits in computing are 255 or 256: it is the natural ceiling of one byte.

Why programmers love hexadecimal

Binary is correct but unreadable — 11111111 is hard to scan and easy to miscount. Hexadecimal is a compact shorthand for it. Because 16 is exactly 2 to the fourth power, every group of four binary digits maps to exactly one hex digit. So one byte (eight bits) is always exactly two hex digits. 11111111 becomes FF; 10000000 becomes 80. This tidy 4-bits-per-digit relationship is why hex shows up everywhere bytes are involved: colour codes, memory addresses, and byte dumps.

DecimalBinaryHex
000000
501015
101010A
151111F
25511111111FF

Converting by hand (so the tool makes sense)

To turn a decimal number into binary, repeatedly divide by 2 and record the remainders from bottom to top. For 13: 13÷2 = 6 r1, 6÷2 = 3 r0, 3÷2 = 1 r1, 1÷2 = 0 r1 — read upward: 1101. To go from binary back to decimal, add up the position values where there is a 1: 1101 is 8 + 4 + 0 + 1 = 13. Hex works the same way with multipliers of 16. You rarely need to do this by hand, but doing it once demystifies what a converter is actually computing.

Try it: Convert between bases free → Enter a number in any base, see it in all of them.

Where you meet each base in real life

  • CSS colours. #FF8800 is three bytes — red, green, blue — each written as two hex digits, so each channel runs 00 to FF (0 to 255).
  • File permissions. Unix chmod 755 is octal (base 8); each digit is three permission bits for owner, group, and others.
  • Network addresses. An IPv4 address is four bytes, usually shown in decimal; IPv6 and MAC addresses are shown in hex.
  • Debugging. Memory addresses and raw byte values in a debugger are almost always hex, prefixed with 0x.

Reading the prefixes

Because the same digits can be valid in several bases (101 is a number in binary, decimal, and hex), notation uses prefixes to disambiguate: 0b101 for binary, 0x101 for hex, and plain 101 for decimal. When you see 0x in code, that is your cue the value is hexadecimal — read each digit as 0–15.

The takeaway

There is only ever one quantity; the base is just the costume it wears. Binary reflects the hardware, hexadecimal is a human-friendly shorthand for binary, and decimal is what we count in. Knowing how the positions multiply lets you read a colour code, a permission flag, or a byte dump without guessing — and when you would rather not do the arithmetic, a converter turns any base into any other in one step.

Try these free tools

No signup, no watermark — works in your browser.

  • 🔢Number Base Converter
    Open tool →
  • 🔤Base64 Encode
    Open tool →
  • 🔗URL Encoder
    Open tool →
  • 🔍Regex Tester
    Open tool →

← Blog index  |  Quick guides  |  All tools

We use cookies for analytics and to show ads. Learn more