Converters

Convert decimal numbers to binary

Decimal to binary converter prints a whole number's bit pattern, with no leading zeros. Developers use it to spell out bitmask constants, serial-protocol fields and flag enums, and to check a value's binary form while debugging. Shortest form is the rule: 15 prints as 1111, not 00001111, and negative input keeps its sign, so -42 becomes -101010. Conversion is exact at any size, because it uses big integers, and one number per line converts a column in one go.

How to use Decimal to Binary

  1. Open Decimal to Binary in the Toolbox101 app.
  2. Type a whole decimal number, such as 182, into the Decimal number box, or several, one per line.
  3. Read the binary result in the Output box; it appears as you type and never pads with leading zeros.
  4. Click Copy and paste the bit pattern into your code, config or notes.

Worked example

Decimal to Binary returns the output below for this input.

Input

182

Output

10110110

Check it yourself: open Decimal to Binary and enter the same input.

Frequently asked questions

Why are there no leading zeros in the output?

The tool prints the shortest representation of the value: 15 becomes 1111 rather than 00001111. Zeros on the left carry no information, so they are dropped. If your target format needs fixed-width bytes, pad the string yourself, for example to eight digits.

Is there a limit on how large a number can be?

No practical one. The conversion uses big integers rather than JavaScript's 53-bit numbers, so 18014398509481983 (2^54 minus 1) gives 54 ones and 2^64 gives a 1 followed by 64 zeros, both exactly. Decimal points are not accepted: a . is reported as an invalid digit.

How do I convert decimal to binary by hand?

Divide the number by 2 repeatedly and collect the remainders from last to first. For 13: 13/2 is 6 remainder 1, 6/2 is 3 remainder 0, 3/2 is 1 remainder 1, and 1/2 is 0 remainder 1, which reads 1101. Check your work by pasting 1101 into the Binary to Decimal tool here.

Decimal to binary or text to binary: which do I need?

Decimal to binary takes one whole number and prints its bit pattern: 65 becomes 1000001. Text to binary instead takes a string and prints each character as its own 8-bit group, so the letter A becomes 01000001. Use the text tool when the input is readable words, and this one when it is a numeric value.

Use Decimal to Binary now

Runs in your browser. Nothing you type is uploaded.