dec to binary calculator

Supports integers and decimal fractions. For fractions, conversion is shown up to the selected precision.

A decimal to binary calculator helps you convert base-10 numbers (the number system we use every day) into base-2 numbers (the number system computers use internally). If you work with programming, computer science, networking, electronics, or digital logic, fast and accurate conversion is essential.

What this dec to binary calculator does

This tool converts a decimal value into binary instantly. It handles:

  • Whole numbers (like 25, 1024, or -7)
  • Fractional decimal numbers (like 10.5 or 3.14159)
  • Negative values using a leading minus sign (e.g., -1010)

For decimal fractions, binary can be non-terminating (similar to repeating decimals in base 10). In those cases, the output is shown up to your selected precision.

How to use it

  1. Enter a decimal value in the input field.
  2. Set your preferred fraction precision (number of bits after the binary point).
  3. Click Convert to Binary.
  4. Use Copy Result to copy the output.

Quick examples

Example 1: Integer conversion

Decimal: 13
Binary: 1101

Example 2: Fraction conversion

Decimal: 10.625
Binary: 1010.101

Example 3: Negative number

Decimal: -42
Binary: -101010

How decimal to binary conversion works

1) Whole-number part: repeated division by 2

To convert an integer, divide by 2 repeatedly. Track each remainder (0 or 1), then read the remainders from bottom to top.

  • 13 ÷ 2 = 6 remainder 1
  • 6 ÷ 2 = 3 remainder 0
  • 3 ÷ 2 = 1 remainder 1
  • 1 ÷ 2 = 0 remainder 1

Reading upward gives 1101.

2) Fractional part: repeated multiplication by 2

For the fractional part, multiply by 2 repeatedly. Each step gives the next binary digit:

  • If result is ≥ 1, digit is 1 and subtract 1
  • If result is < 1, digit is 0

Repeat until the fraction becomes 0 or until you hit your precision limit.

Why binary conversion matters

  • Understanding how computers store and process numbers
  • Debugging low-level code and bit operations
  • Working with memory addresses, masks, and flags
  • Learning digital electronics and logic circuits

Common mistakes to avoid

  • Forgetting to reverse remainders for integer conversion
  • Assuming every decimal fraction has a finite binary form
  • Mixing up signed notation with two’s complement representation
  • Using too little precision for fractional values

Frequently asked questions

Does this tool return two’s complement for negatives?

No. It returns the sign plus magnitude binary form (for example, -5 becomes -101). Two’s complement depends on a fixed bit width (8-bit, 16-bit, 32-bit, etc.).

Why does 0.1 not end neatly in binary?

Because 0.1 decimal is a repeating fraction in base 2. The calculator truncates at your selected precision.

Can I convert very large integers?

Yes, large integers are handled with high precision. Fractional inputs are limited by JavaScript floating-point behavior.

Final note

If you are learning number systems, this decimal to binary converter is a great practice companion. Try a few examples, inspect the step-by-step output, and you will quickly build intuition for binary math.

🔗 Related Calculators