How Base Conversion Works
Every number system you will meet is a place-value system: the value of a digit depends on where it sits in the numeral. In decimal, the number 255 really means 2 × 100 + 5 × 10 + 5 × 1 — that is, 2 × 10² + 5 × 10¹ + 5 × 10⁰. The base of a number system is simply the number that each position is multiplied by. Replace the 10s with 2s and you get binary; with 16s, hexadecimal. The largest digit available is always one less than the base: base 10's biggest digit is 9, base 2's is 1, and base 16's is F, or 15 (because we run out of digits after 9 and borrow letters). Bases beyond 16 keep borrowing letters all the way to Z, which is digit 35 in base 36.
| Base | Name | Digits | Example |
|---|---|---|---|
| 2 | Binary | 0 1 | 11111111 = 255 |
| 8 | Octal | 0–7 | 377 = 255 |
| 10 | Decimal | 0–9 | 255 |
| 16 | Hexadecimal | 0–9 A–F | FF = 255 |
Converting in the direction you already understand is easy: to read a numeral written in another base, expand it into its place values and add them up. Converting the other way — writing a decimal number in a new base — uses the opposite operation: repeatedly divide by the target base and collect the remainders from last to first. The calculator implements both directions under the hood, using whatever base you select as the input and always producing binary, octal, decimal, and hexadecimal as output.
Once a base exceeds ten, letters enter the digit set: A is ten, B is eleven, and so on. Base 36 — the largest this converter accepts — uses all ten digits and all twenty-six letters, which is why it is the classic choice for compressing identifiers: a six-character base-36 string can represent about 2.2 billion distinct values. Most day-to-day work never strays past hexadecimal, but the ability to parse and produce any base 2–36 means the same tool covers binary puzzles, color math, and custom encoding schemes without modification.
Step-by-Step Worked Examples
These examples mirror the calculator's defaults, so you can follow along and confirm every digit.
- 255 decimal in binary, by repeated division: 255 ÷ 2 = 127 remainder 1; 127 ÷ 2 = 63 remainder 1; 63 ÷ 2 = 31 remainder 1; 31 ÷ 2 = 15 remainder 1; 15 ÷ 2 = 7 remainder 1; 7 ÷ 2 = 3 remainder 1; 3 ÷ 2 = 1 remainder 1; 1 ÷ 2 = 0 remainder 1. Reading the remainders upward gives 11111111 — eight ones, exactly what a byte of all-set bits looks like.
- 255 decimal in hexadecimal, faster: 255 ÷ 16 = 15 remainder 15. Fifteen is digit F, so the numeral is FF. This compactness is why hex is the shorthand of choice for bytes, color codes, and memory addresses.
- Reading hex back: FF in base 16. Expand the place values: F × 16¹ + F × 16⁰ = 15 × 16 + 15 × 1 = 240 + 15 = 255. Every base works this way — the rightmost position is always the base raised to the power zero, which is 1.
- Binary with a fraction: 1010.101 in base 2 expands to 1×8 + 0×4 + 1×2 + 0×1 + 1×0.5 + 0×0.25 + 1×0.125 = 10.625 decimal. Fractions are just negative powers of the base: the first place right of the point is base⁻¹, the second is base⁻², and so on.
- 42 decimal in binary, the non-obvious case: 42 ÷ 2 = 21 remainder 0; 21 ÷ 2 = 10 remainder 1; 10 ÷ 2 = 5 remainder 0; 5 ÷ 2 = 2 remainder 1; 2 ÷ 2 = 1 remainder 0; 1 ÷ 2 = 0 remainder 1. Read upward: 101010. Spot-check with place values: 32 + 8 + 2 = 42. The pattern of alternating ones and zeros is typical for numbers that are not powers of two.
The division algorithm works for any target base and any starting value — there is nothing special about 255. Enter any number, pick any input base, and the calculator performs the same expansion in reverse while converting to all four programming bases at once.
Where Base Conversion Shows Up in Real Life
Base conversion is not a classroom exercise — it appears constantly in code, configuration, and debugging. Hexadecimal is the default notation for memory addresses, Unicode code points, and the six-digit color codes in CSS (#FF8800 is a shade of orange). Octal survives in Unix chmod masks like 0755 and some legacy protocols. Binary is what the CPU actually sees, so bitwise operations and flags are usually reasoned about in binary or hex. Even outside programming, base conversion shows up in MAC addresses, IPv6 literals, and serial numbers. A converter that renders every common base at once lets you move between these notations without re-typing values and without the mental arithmetic that invites transcription errors.
Conversion & Reference Tables
Numbers 0–15 in All Four Bases
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Powers of Two and Sixteen
| Power | 2ⁿ | 16ⁿ | In hex |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 1 | 2 | 16 | 10 |
| 2 | 4 | 256 | 100 |
| 3 | 8 | 4096 | 1000 |
| 4 | 16 | 65,536 | 10000 |
| 5 | 32 | 1,048,576 | 100000 |
| 6 | 64 | 16,777,216 | 1000000 |
| 7 | 128 | 268,435,456 | 10000000 |
| 8 | 256 | 4,294,967,296 | 100000000 |
Troubleshooting & Common Mistakes
Digits Outside the Selected Base
The most common error is typing a digit the chosen base cannot represent — a 2 in binary, an 8 in octal, or a G in hexadecimal. The converter flags these with a specific error message rather than guessing, because a single wrong digit changes the entire value. If you see "Invalid digit," check both the number and the selected base: the fix is usually deleting one character or switching the base dropdown.
Reading the Four Result Tiles
All four tiles always show the same underlying value — the input number rendered in each base. If the input base matches one of the four output bases, that tile naturally echoes your input; typing FF in base 16 shows FF in the hex tile and 255 in the decimal tile, so the relationship between the two notations is visible at a glance. The decimal tile is the one to check when you need a ground-truth number, and the binary tile when you need to inspect individual bits.
Leading Zeros Are Harmless
Inputs like 00001111 in binary are perfectly valid — the leading zeros contribute nothing and are dropped from the results. The same applies to decimal input like 0255. This also means results never carry leading zeros, so the binary output of 255 is 11111111, not 0000000011111111, even though the latter is how the value sits in a 16-bit register.
Fractions May Not Terminate
A fraction that terminates cleanly in one base can repeat forever in another — 1/10 decimal is an infinite pattern in binary, while 1/8 binary terminates instantly. The converter caps output at 12 fractional digits, so repeating values are truncated, not rounded. When exactness matters, use fractions whose denominator is a power of the target base, or accept the documented precision limit.
Very Large Numbers
- Numbers up to roughly 9 quadrillion (2⁵³) convert exactly; beyond that, JavaScript's floating-point math limits precision.
- Long binary results wrap onto multiple lines inside the result tiles rather than being cut off.
- For typical programming values — bytes, colors, addresses — precision is never an issue.
Copy-Paste Formatting
Pasted text sometimes carries invisible formatting or a trailing newline. The converter trims surrounding whitespace automatically, so " FF " and "FF" parse identically — but a stray character like a comma or space in the middle of the number is still a real digit error in most bases. If a paste fails validation, look for a comma, an em dash, or a non-breaking space hiding between digits.