Decimal to Binary

Encoders & Decoders

How to use the Decimal to Binary

Convert decimal to binary in two steps:

1

Enter the decimal number

Type or paste any positive integer using digits 0–9. Commas and spaces used for thousands separators are stripped automatically.

2

Read the binary result

The binary output appears instantly, grouped into nibbles (4-bit groups) for readability. The bit count and equivalent hex/octal values are shown below.


When to use this tool

Use to convert decimal values to binary for programming and hardware work:

  • Converting decimal permission values (e.g. Unix chmod 755) to binary to understand which permission bits are set
  • Finding the binary representation of a decimal integer to construct or verify bitmasks in C, Python, or JavaScript
  • Converting decimal register values to binary when reading or writing hardware configuration registers
  • Learning binary representation of common decimal values (powers of 2, 255, 1024) for computer science study
  • Converting color channel values (0–255) to binary for image processing, WebGL, or shader programming
  • Verifying binary encoding of protocol field values when implementing or debugging network protocols

Frequently asked questions

Q:How does decimal to binary conversion work?
The standard algorithm is repeated division by 2: divide the decimal number by 2, record the remainder (0 or 1), then repeat with the quotient until it reaches 0. Reading the remainders from bottom to top gives the binary representation. For example, 13 ÷ 2 = 6 R 1; 6 ÷ 2 = 3 R 0; 3 ÷ 2 = 1 R 1; 1 ÷ 2 = 0 R 1 — reading remainders upward: 1101. The tool uses JavaScript BigInt internally, equivalent to this algorithm but with arbitrary precision.
Q:Why is the binary output grouped with spaces?
The binary output is grouped into 4-bit nibbles with spaces (e.g. '1111 0000' instead of '11110000') for easier reading. Each nibble corresponds to one hexadecimal digit, making it much easier to mentally verify the conversion. You can copy the grouped version directly — the spaces will be stripped automatically by any tool that parses binary, including the Binary to Decimal and Binary to Hex converters on this site.
Q:What decimal numbers can be converted?
Any non-negative integer can be converted — from 0 to numbers with hundreds of digits. The tool uses JavaScript BigInt, which handles integers of arbitrary size without the precision loss that affects standard JavaScript numbers above 2⁵³. Decimal 0 converts to binary 0. There is no upper limit enforced by the tool.
Q:How many binary digits does a decimal number produce?
A decimal number n produces approximately log₂(n) + 1 binary digits. Specifically: numbers 0–1 need 1 bit, 2–3 need 2 bits, 4–7 need 3 bits, 8–15 need 4 bits, and so on. Key reference points: decimal 255 = 8 bits (11111111), decimal 65535 = 16 bits, decimal 4294967295 = 32 bits. Each additional bit doubles the range of representable values.
Q:How do I convert a decimal number to binary manually?
Divide repeatedly by 2 and collect the remainders. Example for 42: 42÷2=21 R0, 21÷2=10 R1, 10÷2=5 R0, 5÷2=2 R1, 2÷2=1 R0, 1÷2=0 R1. Reading remainders from last to first: 101010. Alternatively, identify the largest power of 2 that fits, subtract it, and repeat — 42 = 32+8+2 = 2⁵+2³+2¹ = 101010. Both methods give identical results.
Q:What is decimal 255 in binary and why is it significant?
Decimal 255 is binary 11111111 — eight 1-bits, all bits set in a single byte. It is the maximum value an unsigned 8-bit integer (uint8) can hold. It appears constantly in computing: the maximum value of each RGB color channel (0–255), the maximum single-octet value in IPv4 addresses (255.255.255.255 is the broadcast address), and the mask value for an 8-bit bitfield. The number 256 (= 2⁸) is the first 9-bit number: 100000000.