How Number Bases Work
Everyday numbers are base 10 (decimal): each digit is worth ten times the one to its right. This converter moves a number between the four bases used in computing — binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) — and shows all four versions of the value at once, with the place-value working underneath. Computers store everything in binary because a circuit is either on or off, but long binary strings are almost unreadable, so programmers write the same values in hexadecimal, where one digit packs exactly four binary digits.
Place Values: The Rule Behind Every Base
There is no single conversion formula; there is one rule system. In base b, each digit contributes the digit multiplied by b raised to its position, counting positions from 0 at the right. Decimal 253 means 2×10² + 5×10¹ + 3×10⁰ = 200 + 50 + 3. The place values in binary run 1, 2, 4, 8, 16, 32, 64, 128; in octal they run 1, 8, 64, 512; in hexadecimal they run 1, 16, 256, 4096 — and because base 16 needs sixteen digit symbols, the letters A–F stand for the values 10–15. To bring any base back to decimal, expand it exactly this way and add the parts; to leave decimal, divide repeatedly by the target base and read the remainders in reverse. Converting via decimal always works, and binary–hex conversions have a shortcut because 16 is a power of 2.
Converting Between Bases
- To decimal: multiply each digit by the base raised to its position and add up. Binary 1011 = 1x8 + 0x4 + 1x2 + 1x1 = 11.
- From decimal: repeatedly divide by the target base and read the remainders backwards.
- Binary to hex shortcut: group binary digits in fours and convert each group (1010 1111 = AF).
How to Use This Converter
- Type your number into the Value box — the tool starts with 255 as a working example.
- Choose its current system in the From base dropdown: Binary (base 2), Octal (base 8), Decimal (base 10), or Hexadecimal (base 16).
- Read the four result cards — Binary, Octal, Decimal, and Hexadecimal — which all show the same value in different clothing.
- Study the working lines below, which expand each of your digits as digit × base^position and sum them into decimal. That expansion is the method to copy into homework. If a digit is not allowed in the chosen base — a 2 in binary, say — the tool flags it rather than guessing.
Worked Example 1: Decimal 173 in Binary and Hexadecimal
Convert 173 by dividing by 2 repeatedly and keeping the remainders: 173÷2 = 86 r1; 86÷2 = 43 r0; 43÷2 = 21 r1; 21÷2 = 10 r1; 10÷2 = 5 r0; 5÷2 = 2 r1; 2÷2 = 1 r0; 1÷2 = 0 r1. Reading the remainders from last to first gives 10101101. Verify with place values: the 1s sit in the 128, 32, 8, 4, and 1 places, and 128 + 32 + 8 + 4 + 1 = 173. ✓ For hexadecimal, skip the division entirely and split the binary into groups of four: 1010 and 1101. The first group is 8 + 2 = 10, which is the digit A; the second is 8 + 4 + 1 = 13, the digit D. So 173 = AD in hex, confirmed by A×16 + D = 160 + 13 = 173.
Worked Example 2: Hexadecimal 3F in Decimal, Binary, and Octal
3F is a typical byte value. To decimal, expand by place values: 3 sits in the 16s place and F, worth 15, sits in the 1s place, so 3×16 + 15×1 = 48 + 15 = 63. To binary, turn each hex digit into four bits: 3 = 0011 and F = 1111, giving 0011 1111; leading zeros carry no value, so this is written 111111. To octal, regroup those same bits into threes, from the right: 111 111, which is 7 and 7, so 77. Final check: octal 77 means 7×8 + 7 = 63. ✓ All three answers agree — and notice the economy of hex: two characters carry exactly what six binary digits say, which is why memory dumps and colour codes prefer it.
Why Programmers Love Hex
Memory addresses, color codes (#FF5733), and Unicode values are all written in hex because it is far shorter than binary but converts to it trivially. A single byte (0–255) is always exactly two hex digits. You will meet these conversions when decoding a CSS colour into red, green, and blue components, reading a MAC address or a crash log full of hex addresses, setting Unix file permissions in octal (755 means something precise), or revising for a computer science exam where the division and grouping methods above are done by hand.
Three Mistakes That Break Conversions
- Reading the remainders in the wrong order. After repeated division, the first remainder is the last binary digit. Writing them top-to-bottom reverses the number — 173 becomes a different value entirely.
- Using a digit the base does not own. There is no 2 in binary, no 8 or 9 in octal, and F is worth 15, not 16. One illegal digit invalidates the whole conversion.
- Grouping from the left. When splitting binary into fours (for hex) or threes (for octal), always group from the right and pad the leftmost group with zeros. Grouping from the left puts every digit in the wrong place value whenever the length is not an exact multiple.
Practice Tool
Type a value in any base above and watch all four representations update live, with the conversion steps shown. Also try the Roman numeral converter for a historical number system, or number to words for plain English.