Decimal to binary

Convert decimal to binary as you type, with any number of digits, the method step by step and a reference table.

loading Decimal to binary
About this tool

Decimal and binary

Decimal (base 10) is the everyday system: each digit is worth a power of 10. Binary (base 2) is how hardware stores every number: each digit is a bit, worth a power of 2.

Used to write bit masks, subnet masks and permissions, and to see which bits of a number are set.

This page opens the base converter with decimal as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.

Decimal vs binary

Decimalbinary
Base102
Digits0–90 1
Prefix in code—0b
255 is written25511111111

How to convert decimal to binary by hand

Divide by 2 again and again and write down the remainders; read them from the last to the first. For 156:

DivisionQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Read upwards: 156 = 10011100 in binary.

Decimal to binary table

Values computed by the converter itself:

DecimalBinary
00
11
210
7111
81000
101010
151111
1610000
32100000
641000000
1001100100
1271111111
25511111111
256100000000
10001111101000
102410000000000
40961000000000000
655351111111111111111

Decimal to binary in code

JavaScript

(156).toString(2); // '10011100'

Python

format(156, "b")  # '10011100'

For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(2).

Frequently asked questions

Does it handle very large numbers?

Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.

Can I convert negative numbers or fractions?

Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).

Why do programmers use hexadecimal instead of binary?

Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.

Report a problem