TOP

Free exact browser converter

Decimal to Binary Converter

Convert decimal integers to binary online without precision loss. Handle zero and large numbers, choose a 0b prefix, and reject invalid or fractional input.

No signupRuns locally in your browser

Interactive tool

Convert Decimal to Binary

Ready

Output format

Choose a clear output representation.

Detailed conversion guide

How to Convert Decimal to Binary

Repeated division by 2 yields binary digits from the remainders, read in reverse order. Decimal 59 equals 32 + 16 + 8 + 2 + 1, so the bits at those positions give 111011.

The browser parses the entire decimal input as BigInt and uses base-2 formatting. It keeps integers above 2^53 − 1 exact. A 0b prefix is optional and does not change the binary value.

InputOutputMeaning
00zero
101010decimal 10
59111011decimal 59
25511111111decimal 255

Decimal to Binary with BigInt

The algorithm validates the representation before exact integer conversion, so malformed input never produces a plausible partial answer.

const digits = input.trim();
if (!/^[0-9]+$/.test(digits)) throw Error("Invalid decimal integer");
const bits = BigInt(digits).toString(2);

Fractions, Signed Values, and Binary Width

This page converts unsigned integers. Values such as −1, 0.5, or 1e3 are rejected. Fractional binary expansion and signed two’s-complement encoding require different rules and are not inferred.

The output uses the minimal bit width, with zero written as 0. Input leading zeros do not request padding. Spaces and underscores join decimal digits rather than delimiting multiple numbers.

Related converters

Choose the converter for the input and output formats you are working with.

Advertisement

Sponsored link