Home › Converters › Decimal to Binary

Decimal to Binary

Programmers write numbers in decimal, but computers store every one of them in binary — and subnet masks, permissions and memory dumps all show the binary version. This decimal to binary converter translates instantly and exactly, however large the number. The base boxes also convert octal and hexadecimal in any direction, and the table under the result shows all four bases at once.

The same value in all four bases

BaseValue
Binary (base 2)
Octal (base 8)
Decimal (base 10)
Hexadecimal (base 16)

How it works

Decimal is base 10: ten digits, and each position in a number is worth ten times the one to its right — 1, 10, 100, 1000. Binary is base 2: only two digits, 0 and 1, and each position is worth twice the one to its right — 1, 2, 4, 8, 16 and so on. Both systems write the same whole numbers; they just spend digits differently, which is why binary versions are so much longer: 255 needs three decimal digits but eight binary ones.

Computers use binary because a transistor is either on or off, so one wire naturally holds one binary digit — a bit. Eight bits make a byte, the standard unit of computer storage, and a byte tops out at 255 in decimal. That single fact explains a string of familiar numbers: IP address parts (192.168.0.1) never exceed 255, color channels run 0 to 255, and file permissions and subnet masks are all written against byte-sized pieces of binary.

Decimal to binary: divide by 2 repeatedly, note each remainder, then read the remainders from last to first  |  Check: add the powers of two (…, 64, 32, 16, 8, 4, 2, 1) wherever the binary digit is 1

This converter does the division exactly, with arbitrary-precision whole-number arithmetic, so values of any length convert digit-for-digit — no floating-point rounding, ever. It also converts octal (base 8) and hexadecimal (base 16) in any direction, because the base boxes work independently: pick decimal in the From box and hex in the To box and the same number comes out in hex. The table under the result always shows your number in all four bases at once, which is handy when a manual or a hex dump uses a different base from the one you think in.

If you type a letter or a digit that does not belong in the chosen base — a 2 in a binary number, or a G in a hex number — the converter stops and names the offending character instead of guessing. That check catches most typos in long binary strings before they turn into wrong answers.

Worked example

A networking student in Ohio is checking a subnet mask octet of 255 and wants to see it in binary, the way the textbook writes it.

Step 1: Divide 255 by 2: quotient 127, remainder 1.
Step 2: Keep dividing: 127 → 63 r1, 63 → 31 r1, 31 → 15 r1, 15 → 7 r1, 7 → 3 r1, 3 → 1 r1, 1 → 0 r1.
Step 3: Read the remainders from bottom to top: 11111111.
Step 4: Check by place values: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Correct.

That is exactly what the converter shows for 255 in the decimal box: 11111111, with 377 in octal and FF in hex in the table beneath — three more ways of writing the same full byte.

Common mistakes and tips

The classic mistake is reading the remainders in the wrong order. They must be read from the last division up to the first — bottom to top. Read them top-down for a number like 13 and you get 1011 backwards as 1101, which is a different number (11 instead of 13). The second trap is expecting every decimal number to end in 0 or 1 clues: in binary, even numbers end in 0 and odd numbers end in 1, which is a fast sanity check on any result.

Two patterns worth memorizing: a run of n ones equals 2^n − 1 (1111 = 15, 11111111 = 255), and a 1 followed by n zeros equals 2^n (10000000 = 128). With those two anchors you can estimate most byte-sized values without any division at all. Note that this converter handles whole numbers; decimal fractions such as 0.1 have no short exact binary form, which is a famous quirk of floating-point arithmetic rather than something a converter can fix.

FAQ

What is 255 in binary?

255 in binary is 11111111 — eight 1s. Each 1 adds its power of two: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. It is the largest value a single byte can hold, which is why 255 appears so often in computing, from subnet masks to color values.

How do I convert decimal to binary by hand?

Divide the number by 2 and write down the remainder, then keep dividing the quotient by 2 until it reaches 0. Read the remainders from bottom to top. For 255, every remainder is 1, giving 11111111. For 10, the remainders read upward give 1010.

What is 10 in binary?

10 in binary is 1010. Check it by place values: the 1s sit in the 8 and 2 positions, and 8 + 2 = 10. Written out it looks like the decimal number one thousand ten, but each position is worth a power of two, not a power of ten.

Can this converter handle negative numbers and very large numbers?

Yes to both. A leading minus sign is carried through, so -255 converts to -11111111. And because the conversion uses exact arbitrary-precision arithmetic rather than floating point, values far beyond 64 bits convert digit-for-digit with no rounding.

What is 0 in binary?

0 is 0 in binary — and in octal, decimal and hexadecimal too. Zero has the same written form in every base, so the converter simply returns 0. The same is true of 1: it is 1 in all four bases shown under the result.

Disclaimer: Results are conversions for guidance only. Values are rounded for display; for legal, medical, or safety-critical use, confirm with an official source or a qualified professional.