Understand binary coded decimal
How binary coded decimal turns each decimal digit into four bits, what that changes in your text, and when plain digits are the better choice.
Binary coded decimal (BCD) writes a number one decimal digit at a time. Each digit becomes its own small group of bits. Converting a whole number into binary works differently. When BCD is used as a text transformation, typically through a converter that turns typed digits into strings of 0s and 1s, the main question is practical. Does the output keep the meaning of the number, and can people and software still use it once it leaves the converter? This review covers what the transformation changes, where it helps, and where plain digits are the better choice.
Is BCD suitable for your intended use?
BCD output is suitable when the reader or the receiving system expects BCD. Examples include teaching how digital circuits store digits, matching a hardware or file-format specification, checking a data dump, or preparing test values for firmware, clocks or legacy decimal fields. Its main benefit is that every decimal digit stays separately visible and recoverable, including leading zeros. The decisive tradeoff is that the result can no longer be read, searched or edited as a number without decoding it first.
Plain digits are preferable whenever a person needs to read the value, assistive technology needs to announce it, search needs to find it, or a spreadsheet or form needs to treat it as a number. If you only want text that looks technical or decorative, BCD adds length and decoding effort and gives nothing back.
What the transformation actually changes
In the most common scheme, often called 8421 BCD, each digit from 0 to 9 is replaced by its four-bit binary value. The patterns 1010 through 1111 are unused in standard BCD and are treated as invalid digits. The digits are encoded in their original order, so the number's left-to-right sequence is preserved one nibble (four bits) at a time.
| Digit | 8421 BCD |
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
The difference from ordinary binary conversion shows up quickly. Pure binary encodes the value of the whole number. BCD encodes each digit separately, so it uses more bits, but each group maps directly back to one digit.
Decimal BCD (8421) Pure binary
59 0101 1001 111011
2026 0010 0000 0010 0110 11111101010
007 0000 0000 0111 111
The last row matters for meaning. A code such as 007, a postal code or an account number with leading zeros keeps those zeros in BCD, because each digit is encoded separately. Pure binary keeps only the value, seven, so the zeros are lost.
Stored characters, not visual styling
BCD conversion replaces the stored characters completely. Unicode font styling, mirrored glyphs or CSS presentation only change how existing characters look. BCD output is new text, usually made only of the ASCII characters 0 and 1, sometimes with spaces between groups. Nothing about the original digits survives on screen unless someone decodes the groups.
Packed, unpacked and other variants
Inside computers, BCD is stored in more than one way, and a converter's text output may follow only one of these layouts:
- Packed BCD stores two digits per byte, so 59 occupies a single byte. Viewed in hexadecimal, that byte reads as 59, which is why packed BCD is easy to spot in hex dumps.
- Unpacked BCD stores one digit per byte, with the upper four bits unused or set to a fixed value.
- In mainframe-style packed decimal, the last nibble is often a sign: C for positive, D for negative, F for unsigned. For example, -123 is stored as the nibbles 1 2 3 D.
- Other digit codes, such as Excess-3 and 2421, use different four-bit patterns for the same digits. Output from one scheme will decode incorrectly under another.
Before relying on a converter's output, confirm which scheme it uses, how it orders the groups and whether it handles signs. These details depend on the tool, and no specific tool's behavior was verified for this article.
Clearing up ambiguous terms
"Binary text converter" usually means something different: turning every character, letters included, into the 8-bit or UTF-8 bytes of its character code. In that encoding the digit 5 becomes 00110101, not BCD's 0101. If your input contains letters and the tool produces output anyway, it is probably not doing pure BCD. Standard BCD has no codes for letters, punctuation or decimal points, and a tool may skip, reject or substitute such characters. Decimal-point position is normally tracked separately, as a scale or an agreed field format, rather than stored as a symbol.
Reversal works differently from text reversal too. Reversing a BCD bit string does not reverse the digits; it produces different, sometimes invalid, nibbles. Reversing 0101 1001 bit by bit gives 1001 1010, and 1010 is not a valid digit. To reverse the number, reverse the digit groups and leave each group's bits alone. Combining marks and multi-code-point emoji are not relevant to valid BCD input, which is limited to digits. Non-ASCII digits, such as fullwidth or Arabic-Indic numerals, may or may not be accepted depending on the tool.
Will the result stay readable and usable after copying or sharing?
Because BCD text output is usually plain ASCII 0s and 1s, it does not depend on special fonts or uncommon Unicode characters. That avoids the missing-glyph problems that styled Unicode text can have. The practical risks are elsewhere:
- Spacing: the spaces between four-bit groups help readability but may be removed, collapsed or wrapped by the destination. Without them, decoding still works only if the string length is a multiple of four and no leading zeros were lost.
- Numeric reinterpretation: spreadsheets and some form fields may treat a group like 0101 as the number 101, which silently drops leading zeros and breaks decoding. Storing the value as text or quoting it avoids this, but the exact behavior depends on the application and its settings.
- Search: a search for the decimal value will not match its BCD form, and the reverse is also true. Indexed BCD text is effectively hidden from anyone searching for the number.
- Editing: changing one digit means recomputing its four-bit group by hand, and a single wrong bit can produce a different digit or an invalid one.
For accessibility, a long run of 0s and 1s is hard to follow when read aloud. A screen reader may announce it digit by digit or as one very large number, depending on the software and its settings. No screen reader testing was supplied for this article, so treat that as an open question to check with the assistive technology your audience actually uses. The safe assumption is that BCD output is not an accessible way to present a number on its own.
When you share BCD output for anyone other than a technical reader who needs it, include the plain decimal value alongside it and state the scheme, for example "59, shown as 8421 packed BCD: 0101 1001". That keeps the meaning recoverable for people, search engines and assistive technology, and lets technical readers check the encoding.
Before you use an online converter
A converter's look or marketing language says nothing reliable about whether it logs or keeps what you type. Unless the tool documents how it handles data, avoid pasting account numbers, identifiers or other sensitive values. The conversion is simple enough to do by hand with the table above, or locally in a short script. Check one known value, such as 59 becoming 0101 1001, to confirm the tool uses the scheme you expect.