FileToolsHub logo

Decimal to Binary

Decimal to Binary prints the binary form of the number you type. A blank box becomes 0. A value that is not a number comes back as NaN.

The bits are not padded to eight. A blank box becomes 0.
13
1101

Processing: runs in your browser, nothing uploaded

About Decimal to Binary

A number becomes bits

The box takes the text you type and runs it through the number converter, then prints base 2. 13 becomes 1101. 0 becomes 0. 10.5 becomes 1010.1. A blank box becomes 0, because an empty string converts to the number 0. Text such as abc becomes NaN. There is no error sentence for that case. The word NaN is the result. A leading 0x is not read as hex on this page. Hex belongs on Hex to Decimal or Decimal to Hex. This page does not pad to eight bits. 13 is 1101, not 00001101. Binary Converter pads letters. This page does not. 255 on this page is 11111111. That is eight bits because 255 needs them, not because the page pads every result.

Fraction bits and huge values

A fraction uses a binary point. 0.5 is 0.1. 0.1 cannot be stored as an exact binary fraction, so the printed bits can look long. That is the number format, not a bug you can toggle off. Integers past the safe range lose accuracy before they are printed. Negative numbers print with a minus and the binary magnitude, using the ordinary number conversion, not two's complement. If a lesson wants eight-bit two's complement, this page will not match the worksheet. There is no bit-width field. 0.5 prints 0.1. Try that when you want to see the binary point. Then try 0.1 and expect a long expansion. Do not round it by hand and call the page wrong. A leading minus stays a minus.

Check it against the other direction

Binary to Decimal should turn 1101 back into 13. It will not accept the binary point in 1010.1, because that page allows only 0, 1, and spaces. So a fraction that leaves this page cannot go home through that page. Whole numbers can. Type 255 here and you get 11111111. Hex FF is the same quantity on the hex pages, written differently. Do not paste FF here. The letters make the result NaN. Spaces in a number can also make it NaN. Type 8 and expect 1000. Type 7 and expect 111. Those are powers of two you can add by hand: 8, then 4 plus 2 plus 1.

What people paste by mistake

A sentence, a binary dump that already contains spaces, or a color written in hexadecimal all fail the intent of this box even when some of them print NaN instead of an error. Paste a single number. If you have bits and want the number, switch to Binary to Decimal. If you have letters and want eight-bit groups, switch to Binary Converter. Those three results are not interchangeable. The number stays on this device. A plus sign in front of the digits can still be a number. A comma cannot. 1,000 becomes NaN because of the comma.

How to use

  1. 1

    Type one decimal number.

  2. 2

    Run the conversion.

  3. 3

    Copy the bits. 13 should show 1101, without extra padding.

Privacy

The number is converted to bits in this browser and is not uploaded.

Frequently asked questions

What does 13 become?

1101. It is not padded to eight bits.

What does a blank box do?

It becomes 0, because an empty string converts to the number 0.

What does abc print?

NaN. There is no separate error sentence for text that is not a number.

How are negative numbers shown?

With a minus and the binary magnitude, not as two's complement.

Will 1101 typed here stay bits?

The box reads a decimal number. Bits you already have belong on Binary to Decimal.

Browse all Text Tools · Sitemap