Decimal to Binary Converter

Convert Decimal to Binary instantly in your browser.

0 characters

0 characters

Everything is converted in your browser. Nothing you paste is uploaded or stored.

Worked example

Each row shows a short sample written as Decimal, and the same value converted to Binary.

Decimal input Binary output
72 105 01001000 01101001
83 71 01010011 01000111
116 111 111 108 01110100 01101111 01101111 01101100

In-depth guide

Decimal to binary: repeated division, padding to 8 bits and the 0 to 255 limit

How to turn an everyday number into binary by hand, a table of examples checked with the converter, and what the tool does with commas, minus signs and numbers above 255.

Last verified: Sources: MDN Number.prototype.toString Plain-text version of this guide

Key figures at a glance

Accepted range per number
0 to 255
Each number is treated as one byte. 256 or more is rejected as out of range.
Output width
Always 8 digits per number
Short results are padded with leading zeros, so 5 appears as 00000101.
Commas, hyphens and underscores
Act as separators, not as part of the number
1,000 is read as the two numbers 1 and 0; -5 is read as 5.
Same conversion in JavaScript
(202).toString(2) returns "11001010"
toString does not pad, so 5 would give "101".
Source: MDN Number.prototype.toString

Converting a decimal number by repeated division

Shown for 202; the method works for any whole number.

  1. Step 1: Divide by 2 and note the remainder

    202 / 2 = 101 remainder 0. The remainder is always 0 or 1.

  2. Step 2: Keep dividing the quotient until it reaches 0

    The quotients 101, 50, 25, 12, 6, 3, 1, 0 come with the remainders 0, 1, 0, 1, 0, 0, 1, 1.

  3. Step 3: Read the remainders from last to first

    Bottom to top, the remainders spell 11001010.

  4. Step 4: Pad to 8 digits if you want a full byte

    202 already has 8 digits; 42 becomes 00101010. The converter does this padding for you.

Why repeated division works

A decimal number is a sum of powers of two. Dividing by 2 peels off the smallest power first: the remainder tells you whether the 1s place is switched on, the quotient is what is left for the 2s, 4s, 8s and so on. That is why the remainders come out from the right-hand digit of the binary number to the left-hand one, and why you read them back in reverse.

An alternative is to subtract the largest power of two that fits: 202 - 128 = 74, 74 - 64 = 10, 10 - 8 = 2, 2 - 2 = 0, which switches on 128, 64, 8 and 2 and gives 11001010.

Worked examples

Decimal Binary (8 bits) Which weights are on
5 00000101 4 + 1
42 00101010 32 + 8 + 2
65 01000001 64 + 1
100 01100100 64 + 32 + 4
128 10000000 128
200 11001000 128 + 64 + 8
202 11001010 128 + 64 + 8 + 2
255 11111111 all eight

Every row came from running the converter's code. Several numbers can be entered at once: 72 105 gives 01001000 01101001.

How the converter treats your input

  • Leading zeros are fine. 007 is read as 7 and shown as 00000111.
  • 256 and above are rejected. The tool works on bytes, so it cannot show 300 or 1000 as one binary number. Split the number, or use the division method by hand for larger values.
  • Fractions are rejected. 3.5 is not a valid decimal token for this tool.
  • Separators are broad. Spaces, commas, semicolons, colons, underscores and hyphens all split numbers.

Common mistakes

  • Typing thousands separators. 1,000 becomes the two numbers 1 and 0, giving 00000001 00000000, not 1000 in binary.
  • Typing a negative number. The minus sign is treated as a separator and dropped, so -5 gives the same result as 5: 00000101. The converter does not produce two's complement. If you need -5 as a signed 8-bit value, work out 256 - 5 = 251 and convert that instead; 251 gives 11111011.
  • Reading the remainders top to bottom. The first remainder is the last binary digit.
  • Counting the padding as part of the value. The leading zeros only fill the byte; 00000101 and 101 are both 5.

Tip: To check your own division, convert back with binary to decimal. If the round trip returns your starting number, the working was right.

Frequently asked questions

Is my data sent anywhere?

No. The conversion runs entirely in your browser using JavaScript. Nothing you paste leaves your device, is logged, or is stored.

How should I separate values?

Spaces work, and so do commas, colons and semicolons. For binary, hex and octal you can also paste a single unbroken run of digits — it is split into bytes automatically.

Does it handle emoji and non-English text?

Yes. Text is treated as UTF-8, so accented characters, Chinese, Tamil and emoji all convert correctly. They simply take more than one byte each.

Why did I get an error?

The input contained a character that is not valid for the source format, a value above 255, or a run of digits that does not divide evenly into bytes. The message names the specific token so you can find it.

Sources

  1. MDN: Number.prototype.toString() — toString(2) gives the binary digits of a Number; negative numbers keep a minus sign rather than using two's complement.
  2. MDN: parseInt()

This guide explains published rules in plain language. It is not financial, legal or official advice — rules change, so confirm with the agency linked above before you commit.

Related converters