User Rating 0.0
Total Usage 0 times
Binary: 01000101 01001001  |  Hex: 45 49  |  Decimal: 69, 73
Is this tool helpful?

Your feedback helps us improve.

About

Binary-Coded Decimal (BCD) encodes each decimal digit into a fixed number of binary bits, typically 4 bits per digit. Misinterpreting BCD data as straight binary produces values that drift silently from the intended decimal - a class of bug that corrupts financial records, sensor telemetry, and legacy mainframe data without triggering obvious errors. This tool decodes both packed BCD (two digits per byte, 8 bits total) and unpacked BCD (one digit per byte, upper nibble zeroed or zoned) into readable ASCII text. It also handles EBCDIC-coded decimal mapping for mainframe interchange scenarios.

Conversion validates every nibble against the legal BCD range 0000 - 1001 (decimal 0 - 9). Nibbles outside this range - 1010 through 1111 - are flagged as invalid rather than silently truncated. The tool accepts binary, hexadecimal, and decimal byte representations. Note: this converter assumes unsigned BCD with no sign nibble. Signed BCD variants (where the last nibble encodes sign) require separate handling.

bcd to ascii binary coded decimal bcd converter bcd decoder ebcdic to ascii packed bcd unpacked bcd

Formulas

Packed BCD stores two decimal digits in a single 8-bit byte. The upper nibble holds the tens digit, the lower nibble holds the units digit. Extraction and ASCII conversion proceed as follows:

dhigh = (byte >> 4) 0x0F
dlow = byte 0x0F
ASCIIchar = d + 0x30

Where dhigh is the upper nibble (bits 7 - 4), dlow is the lower nibble (bits 3 - 0), and 0x30 (48 decimal) is the ASCII code for the character "0". Each nibble must satisfy 0 d 9; any value outside this range is not a valid BCD digit.

For unpacked BCD, each byte carries one digit in the lower nibble. The upper nibble is typically a zone field - 0011 in ASCII-zoned BCD (0x30 - 0x39) or 1111 in EBCDIC-zoned BCD (0xF0 - 0xF9). The conversion strips the zone:

d = byte 0x0F

Where byte is the full 8-bit unpacked BCD value. The result d is then converted to ASCII by adding 0x30.

Reference Data

Decimal DigitBCD (4-bit)Unpacked BCD Byte (Hex)Packed BCD (2 digits/byte example)ASCII Code (Dec)ASCII Char
000000x300x00 (with 0)480
100010x310x01491
200100x320x02502
300110x330x03513
401000x340x04524
501010x350x05535
601100x360x06546
701110x370x07557
810000x380x08568
910010x390x09579
Common Packed BCD Byte Examples (two digits per byte)
120001 0010 - 0x1249, 5012
450100 0101 - 0x4552, 5345
780111 1000 - 0x7855, 5678
901001 0000 - 0x9057, 4890
991001 1001 - 0x9957, 5799
Invalid BCD Nibbles (cause conversion errors)
- 1010 (A)0x0AInvalid - Error
- 1011 (B)0x0BInvalid - Error
- 1100 (C)0x0CSign nibble (+) - Sign
- 1101 (D)0x0DSign nibble (−) - Sign
- 1110 (E)0x0EInvalid - Error
- 1111 (F)0x0FUnsigned sign / fill - Fill

Frequently Asked Questions

Packed BCD stores two decimal digits per byte - one in the upper nibble (bits 7-4) and one in the lower nibble (bits 3-0). This is space-efficient: the value 42 is stored as a single byte 0x42. Unpacked BCD uses one full byte per digit. The lower nibble holds the digit (0-9) and the upper nibble is a zone code - typically 0x3 for ASCII-zoned systems or 0xF for EBCDIC-zoned systems. Unpacked BCD is easier to process but uses twice the storage.
BCD encodes decimal digits 0-9 only. A 4-bit nibble can represent 0-15 (0x0-0xF), but values 10-15 (0xA - 0xF) have no corresponding decimal digit. In some signed BCD conventions, nibbles 0xC and 0xD serve as positive and negative sign indicators in the last byte, and 0xF may act as an unsigned filler. Values 0xA, 0xB, and 0xE are always invalid and indicate corrupted data or a non-BCD encoding.
In ASCII-zoned BCD (used on most modern systems), the upper nibble of each unpacked byte is 0x3, producing byte values 0x30-0x39 - which happen to be the ASCII codes for "0" - "9". In EBCDIC-zoned BCD (IBM mainframes), the upper nibble is 0xF, producing byte values 0xF0-0xF9. The lower nibble in both cases holds the actual digit. This converter handles both zone conventions by masking off the upper nibble.
This tool processes unsigned BCD data. In signed packed BCD, the last nibble encodes the sign (0xC for positive, 0xD for negative, 0xF for unsigned). If you input signed BCD data, the sign nibble will be flagged as an invalid digit. To handle signed BCD, strip the final nibble manually and apply the sign to the resulting decimal string before conversion.
Three formats are supported. Binary: strings of 0s and 1s, optionally separated by spaces (e.g., '0100 0101'). Hexadecimal: pairs of hex characters, optionally space-separated (e.g., '45 90 12'). Decimal bytes: comma-separated decimal byte values from 0-255 (e.g., '69, 144, 18'). All formats are parsed into raw bytes before BCD decoding is applied.
BCD operates on 4-bit nibbles. For packed BCD, each byte requires exactly 8 bits (2 nibbles = 2 digits). For unpacked BCD, each byte is also 8 bits (1 zone nibble + 1 digit nibble). If your binary string (after removing spaces) does not divide evenly into 8-bit groups, the converter cannot form complete bytes and will report an error. Pad with leading zeros to reach a multiple of 8 bits.