1. Home
  2. Developer tools
  3. Decimal to Binary

Decimal to Binary

Enter a decimal number and get its binary form together with the repeated-division working that students are asked to show. Fractions are converted by repeated multiplication and flagged when they do not end.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Decimal to Binary

  1. Enter decimal numbers, one per line.
  2. Read the binary result and the division and remainder table.
  3. Copy it, or switch on grouping to read the bits in blocks of four.

Features

  • Division-by-two table with every remainder
  • Fractions by repeated multiplication, cut off with a marker when they never end
  • Handles integers of any size
  • Optional 0b prefix and groups of four bits
  • Negative numbers keep their sign
  • Converts many numbers at once

Supported formats

Input

  • Typed or pasted numbers

You get

  • Binary
  • Division table

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Decimal to Binary is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Fractions that do not end in the target base are cut after 24 digits and marked with an ellipsis.
  • Negative numbers are shown with a minus sign, not as a two’s complement bit pattern.

Guide

Writing decimal numbers in binary with repeated division

Anyone who has written a number in binary by hand has used the same trick: keep halving it and note what is left over. This page performs that routine instantly and prints each step, so it works as a calculator when you are in a hurry and as a worked solution when you are learning the method.

The division method

Divide the number by 2. Write down the remainder, which is always 0 or 1, and divide the quotient by 2 again. Stop when the quotient reaches 0. The remainders, read from the last one to the first one, are the bits of the answer. The reason it works is that each division peels off the lowest bit: an even number ends in 0, an odd one in 1, and halving the number shifts everything one place to the right.

Fractions are done the other way round

The part after the decimal point is multiplied by 2 instead. Each time the result passes 1, that step’s digit is 1 and the 1 is removed; otherwise the digit is 0. Take 0.625: doubling gives 1.25 (digit 1), then 0.5 (digit 0), then 1.0 (digit 1), so the fraction is .101. When the doubling never lands on exactly zero, the binary expansion is infinite. Decimal 0.1 is such a case, and the page prints 0.000110011001100110011001… with an ellipsis after 24 digits.

Options

“Add 0b prefix” puts the marker that many languages use in front of the result, and “Group digits” splits long answers into readable blocks. Neither alters the number. You can paste a list of numbers, one per line, and every line is converted. If one line is invalid, it gets its own message with the position of the bad character and the rest still convert.

Negative numbers

A minus sign stays in front of the binary digits: −13 is shown as −1101. That is sign-and-magnitude written in text, not how a processor stores the value. If you need the 8-, 16- or 32-bit pattern for −13, the two’s complement calculator gives it, including the range of values that fit the chosen width.

A worked example

The Sample button loads 2026. The divisions run 2026 → 1013 → 506 → 253 → 126 → 63 → 31 → 15 → 7 → 3 → 1 → 0 with remainders 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1. Read from the bottom up they spell 11111101010, an 11-bit number. The “other bases” box confirms it with 3752 in octal and 7EA in hexadecimal, and you can verify the binary by adding 1024 + 512 + 256 + 128 + 64 + 32 + 8 + 2, which is 2026.

Limits

Results are exact for whole numbers of any size, but binary fractions can only match decimal ones that are sums of powers of one half. The cut-off after 24 digits is a display decision, not an error margin you can rely on in calculations. The page does not choose a bit width for you; leading zeros are dropped, so a byte value such as 5 is shown as 101 and you must pad it yourself when a format wants eight digits.

Checked against the current version of the Decimal to Binary on .

Frequently asked questions

How many bits do I need to store a given decimal number?

Take the base-2 logarithm, round it down and add one. The number 2026 needs 11 bits because 2 to the 10th is 1,024 and 2 to the 11th is 2,048, which is above it. Signed storage needs one extra bit for the sign.

What does the ellipsis after a binary fraction mean?

It marks a result that would continue forever. Decimal 0.1 becomes 0.000110011001100110011001… with the group 0011 repeating, so the page stops after 24 digits and says so instead of pretending the cut-off value is exact.

Why does 0.1 never finish in binary?

Because 1/10 has a factor of 5 in its denominator and binary only terminates for fractions whose denominator is a power of two. The result repeats 0.0001100110011… and this page cuts it off and marks it.

How many bits does a number need?

A positive integer n needs floor(log2 n) + 1 bits, so 255 needs 8 and 256 needs 9. Signed storage needs one more for the sign.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.