OtherCalculators

Decimal to Binary Converter

Enter a decimal number to see it in binary, with the repeated division by 2 laid out row by row and the remainders read back into the answer.

Hexadecimal, octal and the number of bits and bytes the number needs are shown alongside, exactly, for numbers of any size.

Last updated: · Reviewed by Shakeel Alvi, OtherCalculators

Calculator mode

Type in any field

The other fields update as you type. Spaces, underscores and the prefixes 0b, 0o and 0x are fine, and a leading minus sign makes the number negative.

Group binary digits
Hex letters

45₁₀ in binary

0010 1101

Hexadecimal
2D
Octal
55

Bits
6
Bytes
1
Fits in
8-bit unsigned

Step-by-step working

Which working to show

Divide by 2 and write down the remainder. Repeat on the quotient until it reaches 0, then read the remainders from the bottom up.

Repeated division of 45 by 2
DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Remainders read from the last row to the first:4510 = 1011012

Exact at any size

Whole numbers are worked digit by digit, so 64-bit values and beyond never round off after 15 or 16 digits. Floating-point mode prints the exact value the bits store.

Runs in your browser

What you enter is worked out on this page and is not sent anywhere. Copy the address to share a conversion.

Decimal to BinaryDivide by 2RemaindersBits & Bytes64-bit Exact

Quick answer

To convert decimal to binary, divide the number by 2, write down the remainder, and repeat with the quotient until it reaches 0. Then read the remainders from the last to the first. For 45 the remainders are 1, 0, 1, 1, 0, 1, so 45 in decimal is 101101 in binary.
Guide

How the decimal to binary converter works

Type a whole number into the Decimal field and its binary form appears in the result card, grouped into fours so it is easy to read and to compare with the hexadecimal digits. The step-by-step panel opens on the repeated division by 2, with one row for each division, the quotient carried down to the next row and the remainder that becomes each bit.

Below the result, the bit count shows how many binary digits the number needs, and the “fits in” figure gives the smallest standard 8, 16, 32 or 64-bit integer that can store it. To go the other way, use the binary to decimal converter; for hex, octal and other bases, the binary converter.

How the maths works

The repeated division method

n = 2 × q + r, where r is 0 or 1
Next row: n ← q, until q = 0
Binary = remainders read last to first

Example: 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1. Reading upward gives 1101, and 8 + 4 + 1 = 13 confirms it.

Worked example

Worked examples

Example 1 — repeated division

Decimal:
45
  1. 45 ÷ 2, 22 ÷ 2: r 1, r 0
  2. 11 ÷ 2, 5 ÷ 2: r 1, r 1
  3. 2 ÷ 2, 1 ÷ 2: r 0, r 1
  4. Read upward: 1 0 1 1 0 1

Binary: 101101

Example 2 — subtracting powers of 2

Decimal:
200
  1. Largest power that fits: 128 → 72 left
  2. Next powers that fit: 64 → 8 left, 8 → 0 left
  3. Bits for 128, 64, 8: 1 1 0 0 1 0 0 0

Binary: 11001000

Every power of 2 that was skipped (32, 16, 4, 2, 1) becomes a 0.

Reference data

Common decimal numbers in binary

Frequently converted decimal numbers in binary and hexadecimal, with the bits each needs
DecimalBinaryHexBits
510153
101010A4
161 0000105
4210 10102A6
64100 0000407
100110 0100647
127111 11117F7
1281000 0000808
2551111 1111FF8
2561 0000 00001009
1,00011 1110 10003E810
1,024100 0000 000040011
65,5351111 1111 1111 1111FFFF16
Source: OtherCalculators — computed with the converter's own integer engine — binary grouped in fours from the right

Key facts

  • Repeated division by 2 converts any whole number to binary: each remainder is one bit, and the first remainder is the rightmost bit.
  • Every power of 2 is a 1 followed by zeros in binary, so 128 is 10000000 and 1,024 is 10000000000.
  • A number one less than a power of 2 is all 1s in binary: 127 is 1111111 and 255 is 11111111.
  • 255 is the largest number that fits in 8 bits; 256 needs 9.
Tips

Common decimal to binary mistakes

  • Reading remainders top-down. That reverses the number: 45 would come out as 101101 by luck, but 13 would wrongly become 1011.
  • Stopping at quotient 1. Divide once more: 1 ÷ 2 = 0 remainder 1 supplies the leading bit.
  • Dropping a 0 remainder. Every division produces a bit, including the zeros in the middle.
  • Forgetting to check. Add the place values of the 1 bits; they must give back the number you started with.

Converting decimal to binary is part of England's GCSE computer science content (source: DfE subject content), so it is worth practising with every division written out.

FAQ

Frequently Asked Questions

What is 10 in binary?

10 in decimal is 1010 in binary. Dividing by 2 gives remainders 0, 1, 0, 1, and reading them from the last to the first gives 1010. Check: 8 + 2 = 10.

What is 100 in binary?

100 is 1100100 in binary. It is 64 + 32 + 4, so the bits for 64, 32 and 4 are 1 and the rest are 0.

Why do you read the remainders from the bottom up?

The first division by 2 finds the remainder for the 1s place, which is the rightmost bit. Each later division finds the next place to the left, so the last remainder is the leftmost bit. Reading from the bottom up writes them in the right order.

Is there a way to convert without dividing?

Yes — subtract powers of 2. Find the largest power of 2 that fits, write a 1 in that place, subtract it, and repeat with what is left. For 156: 128 fits (28 left), then 16 (12 left), 8 (4 left) and 4 (0 left), so 156 is 10011100.

How many bits does a number need?

A positive whole number n needs one more bit than the largest power of 2 that fits in it, which is ⌊log₂ n⌋ + 1. 255 needs 8 bits and 256 needs 9. The converter shows the bit and byte count for every number you enter.

How do you convert a decimal fraction such as 0.625 to binary?

Multiply the fraction by 2 repeatedly and take the whole-number part each time: 0.625 × 2 = 1.25 (1), 0.25 × 2 = 0.5 (0), 0.5 × 2 = 1.0 (1), so 0.625 is 0.101 in binary. This converter handles whole numbers; fractions like 0.1 never end in binary.

Keep going

Notes & Assumptions

  • Decimal input is read as a whole number, exactly, up to 4,096 digits long.
  • Negative numbers keep a minus sign, so −45 is −101101. Fixed-width two's complement patterns are a separate representation and are not produced here.
  • Decimal fractions are not converted; the FAQ above explains the multiply-by-2 method for them.

This tool is for education and general calculation. Check results that feed into production code against your platform's documentation.