Guide
Binary-coded decimal: packed, unpacked and Excess-3
Binary-coded decimal is the odd one out among number systems: it is not a base but a way of writing decimal digits in bits. Each digit from 0 to 9 gets its own small group of bits, and the groups are placed side by side. A processor can add them with special adjust instructions, and a display driver can show them without any division by ten. This page encodes and decodes the three variants you are most likely to meet.
Packed BCD
In packed BCD two digits share a byte, one in each half. The number 59 becomes 0101 1001: the 5 is 0101 and the 9 is 1001. Read as hexadecimal, that byte is 59, which is why packed BCD is easy to eyeball in a memory dump. Real-time clock chips store seconds, minutes and hours in this form, so a register that reads 0x59 means fifty-nine, not eighty-nine.
Unpacked BCD
Unpacked BCD spends a whole byte on every digit, with the upper four bits normally zero. The digits 2, 0, 2, 6 become 00000010, 00000000, 00000010 and 00000110. It wastes space but it is simple to process one byte at a time, and it is close to the way ASCII digits work, where the character for a digit is the digit’s value plus 0x30.
Excess-3
Excess-3 adds three to each digit before writing it in four bits, so 0 becomes 0011 and 9 becomes 1100. The code is self-complementing: inverting every bit of a digit gives the code for nine minus that digit. That property made subtraction by complement convenient in early hardware. The code table printed on the page shows the 8421 and Excess-3 patterns for all ten digits side by side.
Using the page
Choose a direction, pick the variant, and type a decimal number or paste the bits. The result appears with spaces between groups, without spaces, and as hexadecimal, and a table lists the group assigned to each digit. When decoding, spaces between nibbles are optional. Any group above 1001 is reported, together with its position, because the data is probably not BCD at all, or is a BCD value with a sign nibble that this page does not interpret.
A worked example
The Sample button loads 2026. In packed BCD it becomes 0010 0000 0010 0110, which is the hexadecimal number 2026 and takes two bytes. In unpacked BCD it is 00000010 00000000 00000010 00000110, which takes four. In Excess-3 each digit is raised by three first, giving 0101 0011 0101 1001. Compare that with plain binary, where 2026 is 11111101010 and needs eleven bits: BCD is longer, but each digit is separately readable.
Limits
Only the digits 0 to 9 are coded. There is no handling of a minus sign, a decimal point, or the sign nibbles that some mainframe formats add, and no support for the densely packed decimal scheme used in decimal floating-point. Arithmetic is not performed here; the page converts representations. If you have a plain binary number and want its decimal value, use the binary-to-decimal page, because that reads the bits as a single number, not as digits.
Related tools
- Binary to Decimal reads a bit string as one number rather than as digit codes.
- Decimal to Hex writes the same decimal value in base 16.
- Gray Code Converter is another bit code used in hardware.
- Text to Binary encodes characters, including digit characters, as bytes.
Checked against the current version of the BCD Converter on .

