Binary to BCD Converter

Parses a binary string as an unsigned integer, then re-encodes each decimal digit of that value as its own 4-bit BCD nibble, space-separated. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Binary-Coded Decimal is a middle ground between decimal and pure binary: it keeps each decimal digit distinct by giving it its own 4-bit nibble, which makes exact decimal rounding and digit-by-digit display trivial.

This tool takes a binary number, works out its decimal value, and re-encodes that value in BCD so you can see the nibble-per-digit breakdown.

What Is Binary to BCD Converter?

A converter that treats a binary input as an unsigned integer and outputs its Binary-Coded Decimal representation: one 4-bit nibble per decimal digit.

It's the inverse of the BCD to Binary Converter, which takes BCD nibbles back to a plain binary value.

How Binary to BCD Converter Works

The binary input is validated and parsed as a JavaScript BigInt, which safely handles values beyond 32 or 53 bits.

The BigInt's decimal string representation is read digit by digit, and each digit (0-9) is converted to a 4-bit binary nibble via `toString(2)` and zero-padding, then joined with spaces.

When To Use Binary to BCD Converter

Use it when you need to see how a binary value would be represented in a BCD-based system, like an old calculator, digital clock, or embedded display driver.

It's also useful for teaching the distinction between pure binary and BCD encoding using a concrete conversion.

Often used alongside BCD to Binary Converter.

Features

Advantages

  • Uses BigInt internally, so it correctly handles binary values of any length, not just 32-bit integers.
  • Produces a clearly delimited, digit-aligned nibble sequence that's easy to read back manually.
  • Deterministic and instant, fully client-side.

Limitations

  • Only handles non-negative (unsigned) values; there's no signed BCD representation supported here.
  • Output grows faster than the input in bit count, since BCD spends a full nibble per decimal digit even though a nibble can hold up to 15.

Examples

Binary 1111 to BCD

Input

1111

Output

0001 0101

Binary 1111 is decimal 15. Digit 1 becomes nibble 0001 and digit 5 becomes nibble 0101.

Binary 10100 to BCD

Input

10100

Output

0010 0000

Binary 10100 is decimal 20. Digit 2 becomes nibble 0010 and digit 0 becomes nibble 0000.

Best Practices & Notes

Best Practices

  • Double check whether your downstream system expects leading-zero nibbles for a fixed digit count; this tool only outputs as many nibbles as the value actually has digits.
  • Use the paired BCD to Binary Converter to round-trip and confirm a conversion.

Developer Notes

Implemented with JavaScript's native BigInt for the initial binary-to-integer parse (via the `0b` prefix string form) to avoid precision loss on wide inputs, then plain string/digit manipulation for the BCD nibble encoding.

Binary to BCD Converter Use Cases

  • Converting a binary value for display on a BCD-driven seven-segment display or legacy digital system
  • Teaching the difference between pure binary and Binary-Coded Decimal encoding
  • Cross-checking a manually performed binary-to-BCD conversion

Common Mistakes

  • Assuming BCD is more compact than binary; it's actually less space-efficient since 4 bits per digit wastes the range 10-15.
  • Forgetting BCD nibbles are per-digit, not per-bit-group, so the nibble count matches the decimal digit count, not the binary bit count.

Tips

  • Feed the output straight into the BCD to Binary Converter to confirm you get your original input back.
  • For very large binary values, expect proportionally more BCD nibbles, one per decimal digit of the equivalent decimal number.

References

Frequently Asked Questions