Convert a decimal number to binary using repeated division by two – the steps panel lists every division and remainder for your exact input, however large.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
From a value to bits
Encoding a decimal number in binary asks: which powers of two sum to it? The classical algorithm answers mechanically — divide by two repeatedly, and the remainders (each 0 or 1) are the binary digits, last remainder first. The steps panel performs it on your number, however long.
Decimal and binary are both positional; only the base differs. Ten symbols versus two means decimal is denser on paper, binary is what transistors can store — and this conversion is the bridge every stored number crosses.
Worked example
Input: 173 173 ÷ 2 = 86 r 1 86 ÷ 2 = 43 r 0 43 ÷ 2 = 21 r 1 21 ÷ 2 = 10 r 1 10 ÷ 2 = 5 r 0 5 ÷ 2 = 2 r 1 2 ÷ 2 = 1 r 0 1 ÷ 2 = 0 r 1 Read upward: 10101101
Why the remainders come out reversed
The first division asks whether the number is odd — that is the ones bit, the LAST digit of the result. Each successive division peels the next-higher bit. Writing remainders bottom-up is therefore not a convention but a consequence of extracting low bits first.
Sizing intuition
A value needs ⌊log₂n⌋+1 bits: 173 sits between 128 and 255, so eight bits. That instinct — 255→8 bits, 65535→16, 4 billion→32 — is what lets engineers size fields and spot truncation risks before they bite.
Scope, exactness, privacy
Negative inputs produce a signed magnitude (-101 for -5), the mathematician’s convention; hardware two’s-complement patterns come from the Decimal to Signed Binary encoder. Fractions belong to the Decimal Fraction to Binary page, where repeating expansions are detected. Whole-number conversion here is BigInt-exact and entirely local to your browser.
How to use the Decimal to Binary Converter
- Enter the decimal number (a leading minus sign is allowed).
- Click "Convert to binary".
- Open "Show calculation steps" to see the repeated division: every quotient and remainder for your exact number.
- Toggle digit grouping or the 0b prefix in the options if you need a specific format.
Frequently asked questions
How is a decimal number converted to binary?
Divide by 2 repeatedly and record each remainder; the remainders, read bottom-up, are the binary digits. 173 gives remainders 1,0,1,1,0,1,0,1 through eight divisions, hence 10101101. The steps panel performs this with your number, not a canned example.
Why read the remainders backwards?
The first division extracts the LAST binary digit – the ones place – because it asks "is the number odd?". Each further division peels off the next-higher bit, so the final remainder is the leading digit.
How many bits will my number need?
The bit count of n is floor(log2(n)) + 1: numbers up to 255 fit in 8 bits, up to 65,535 in 16. The result panel's digit count tells you at a glance whether a value fits a register width.
Can I convert negative decimals?
Yes – the sign passes through, giving a signed magnitude like -101 for -5. That is standard mathematical notation. Hardware instead stores negatives in two's complement, which the Decimal to Signed Binary converter produces.
Does the tool round very large numbers?
Never. BigInt arithmetic means a 40-digit decimal converts exactly – every one of its 130-odd bits is correct. This is the case where float-based converters quietly fail.
What about decimal fractions like 0.7?
Different algorithm, different page: fractions convert by repeated multiplication and can repeat forever. The Decimal Fraction to Binary converter handles that and detects the repetition.
Where is the conversion computed?
On your device, in the page's JavaScript. The number never reaches a server, so pasting internal IDs or license counts carries no exposure.