Skip to content
100% local

BCD decoder

Convert binary-coded decimal nibbles to a decimal number, or the other way round.

Input

BCD decoder

Binary-coded decimal (BCD) represents a decimal number by encoding each digit separately as its own 4-bit binary group, instead of converting the whole number to binary at once. This tool reads a sequence of BCD nibbles — written space-separated like "0101 0111" or as one continuous run of bits like "01010111" — and returns the decimal number they represent. It also runs in reverse: type a decimal number and it expands each digit into its 4-bit BCD nibble.

Direction is detected automatically: a string made only of 0s and 1s is read as BCD to decode, anything else is treated as a decimal number to encode. Use the direction option to force one mode when the input is ambiguous, such as a short run like "10" that is valid either way. The nibble separator controls how groups are split apart on decode and joined back together on encode — space by default, but any character or an empty string works, so you can match the format a datasheet or a legacy system expects.

Every 4-bit group is checked as it is read. A group that isn't exactly 4 bits long, or one that falls in the 1010–1111 range that BCD never uses, is reported as an error naming the offending group rather than silently turned into a wrong digit — the same care matters for hardware protocols, serial dumps and old database formats where a misread nibble means a corrupted value. Leading zero digits are kept, since a zero nibble is a real digit position in BCD, not padding to strip.

Everything runs locally in your browser. The BCD strings and decimal numbers you paste in are never uploaded anywhere, so it's safe to use with data pulled from real embedded devices, RTC chips, calculators or other systems that still store values in BCD.

FAQ

What input formats does it accept?
Space-separated nibbles like "0101 0111", or one continuous string of bits like "01010111" — both decode to the same result. A custom separator (comma, dash, newline…) also works once you set it in the nibble separator option.
Why does it reject some 4-bit groups?
BCD only assigns meaning to 0000 through 1001 (the digits 0–9). Groups from 1010 to 1111 have no decimal digit in BCD, so the tool flags them as an error instead of guessing a value.
How do I convert a decimal number to BCD?
Set the direction to "Decimal to BCD" (or just type a number with a digit above 1 — auto-detect picks encode). Each digit becomes its own 4-bit nibble, joined by the separator you choose.
Does it handle leading zero digits correctly?
Yes. "0000 0101 0111" decodes to "057", not "57" — a leading zero nibble is treated as a real digit position, since that is how packed BCD represents fixed-width numbers.
Is my data uploaded anywhere?
No. Conversion runs entirely in your browser, and your input never leaves your device.