NathanTools
NathanTools
Text Tools 13
SEO Tools 7
Image Tools 19
YouTube Tools 38
Device Tests 4
PDF Tools 10
Calculators 52
Electrical Calculators 10
Time Tools 7
Random Tools 9
Converters 14
Developer Tools 11
Hash Generators 5
Password & Security 2
Network & DNS 3
Website Tools 9

Decimal to Binary Converter

Enter a decimal number to convert it to binary instantly, with every step of the working shown. Fractions and negative numbers work too.

100% free No sign-up Works on any device

Fractions (101.11) and negative numbers (-42) work too. Prefixes like 0x, 0b and 0o are accepted.

Result

Show the working

Divide the number by 2 repeatedly and write down each remainder. Reading the remainders from bottom to top gives the binary digits.

Updated November 2026 · Exact arbitrary-precision conversion in your browser

How to convert decimal to binary

Divide the number by 2 repeatedly and write down each remainder. Reading the remainders from bottom to top gives the binary digits.

Worked example: convert decimal 2026 to binary.

DivisionQuotientRemainder
2026 ÷ 210130
1013 ÷ 25061
506 ÷ 22530
253 ÷ 21261
126 ÷ 2630
63 ÷ 2311
31 ÷ 2151
15 ÷ 271
7 ÷ 231
3 ÷ 211
1 ÷ 201

Reading the remainders from the bottom up gives 11111101010.

Type any decimal number in the converter above and open Show the working to see these steps for your own value.

Powers of two

Each binary digit is worth a power of two. Knowing these makes binary conversions quick to check:

PowerValuePowerValue
20128256
21229512
2242101,024
2382112,048
24162124,096
25322138,192
266421416,384
2712821532,768
2825621665,536

Convert decimal to binary in Excel and code

WhereFormulaResult
Excel / Google Sheets=BASE(2026, 2)11111101010
Pythonformat(2026, "b")11111101010
JavaScript(2026).toString(2)11111101010

Quick reference

DecimalBinaryOctalHexadecimal
0000
1111
21022
711177
81000108
10101012A
15111117F
16100002010
3111111371F
64100000010040
100110010014464
25511111111377FF
256100000000400100
1000111110100017503E8
1024100000000002000400

Negative numbers and two's complement

On paper, a negative number just gets a minus sign: −45 is −101101 in binary. Computers store whole numbers in a fixed number of bits using two's complement: invert every bit of the positive value and add 1. In 8 bits, 45 is 00101101, so −45 is 11010011 (hex D3). Enter a negative whole number above to see its 8, 16, 32 and 64-bit forms.

Where you'll see these number systems

  • Binary: how computers store everything; bit masks, flags and network subnet masks.
  • Octal: Unix and Linux file permissions such as chmod 755.
  • Decimal: everyday counting, and how most programs display numbers.
  • Hexadecimal: colour codes (#FF5733), memory addresses, MAC addresses, Unicode code points and hashes. One hex digit is exactly 4 bits, so two digits make a byte.

Frequently asked questions

Divide the number by 2 repeatedly and write down each remainder. Reading the remainders from bottom to top gives the binary digits. For example, decimal 2026 is 11111101010 in binary.

Decimal 2026 equals 11111101010 in binary.

Use =BASE(2026, 2), which returns 11111101010. Excel's DEC2BIN, OCT2BIN and HEX2BIN only handle values up to 511, so BASE() (Excel 2013 and later) is the reliable choice for binary.

Yes. Type a point for fractions (for example 101.101 or 0.1) and the converter gives up to 30 digits after the point, marking results that repeat forever. Type a minus sign for negative numbers; whole negative numbers also show their two's complement form, which is how computers store them.

No practical limit. The converter uses arbitrary-precision integers (BigInt), so numbers with hundreds of digits convert exactly, unlike a normal calculator, which rounds after about 15–17 significant digits.
All Converters
Esc
↑ ↓ to moveEnter to open