BCD converter: decimal ↔ packed 8421

Convert decimal to packed 8421 BCD and back, with invalid-nibble checks.

Was this helpful?
Share Tool

59 in packed 8421 BCD is 0101 1001: each decimal digit becomes its own 4-bit nibble (5→0101, 9→1001). That is not the same as pure binary 111011 (which is the integer 59 as a place-value sum). This page maps digits both ways and rejects invalid nibbles 1010–1111.

Need ordinary binary instead? Decimal to binary prints 111011. The four-base box is the binary converter hub.

59 → 0101 1001. Decode the same groups back to 59. 9 is 1001. A nibble 1010 is not a digit — 10 through 15 have no 8421 glyph, so the widget shows a red invalid-nibble alert.

Weights inside a nibble are 8-4-2-1, hence the name. Packed BCD concatenates those nibbles; unpacked BCD would insert extra 0000 high bits, which this page does not emit. Reveal the working panel for the digit map and the pure-binary contrast (59 as 111011 versus 0101 1001).

A three-digit value such as 255 becomes 0010 0101 0101 — twelve bits, not the eight-bit integer 11111111. Hardware that talks BCD to a seven-segment display wants the packed form; a CPU adder wants the pure bits. Gray code is a different encoding — that is the Gray code converter. Nothing is uploaded.

How to convert decimal and BCD

  1. Choose Decimal → BCD or BCD → Decimal. The sample 59 encodes to 0101 1001.
  2. Type a non-negative integer, or paste 4-bit groups (spaces and underscores allowed).
  3. Read packed BCD, the decimal, and the pure binary of the same integer so you can see 59 ≠ 111011.
  4. Open Step-by-step working for the 8421 map. Invalid nibbles 1010–1111 show a red alert.

Key Features

  • Decimal ↔ packed 8421 BCD
  • Invalid-nibble detection (1010–1111)
  • Side-by-side pure binary (59 → 111011 vs 0101 1001)
  • 0–9 digit table
  • Local, no upload

Digit-by-digit 8421

  • 0=0000, 1=0001, 2=0010, 3=0011, 4=0100, 5=0101, 6=0110, 7=0111, 8=1000, 9=1001. Concatenate in digit order.
  • 59 → 0101 1001. 255 → 0010 0101 0101. Leading zeros on the decimal are kept as nibbles only if you typed them.
  • Pure binary of 59 is 111011 (32+16+8+2+1). Packed BCD is eight bits because two digits need two nibbles. Density is the trade-off.
  • Decode requires a multiple of 4 bits. 0101100 (7 bits) is not a packed BCD paste.
  • Pocket calculators historically stored 59 as 0101 1001 so each keypress stayed a decimal digit. A binary ALU would rather see 111011. Both encodings are “correct”; they answer different hardware questions.

Invalid codes 1010–1111

  • A nibble 1010 is decimal 10, which is not a single 8421 digit. 1011–1111 are 11–15. This page rejects them instead of inventing a digit.
  • Some calculators used “excess-3” or 2421 codes; those are not 8421 and will not decode here.
  • Packed BCD is not Gray. Gray 0100 is decimal 7 on the Gray page; BCD 0100 is the digit 4.
  • Negatives and fractions are out of scope. Two’s complement lives on decimal to binary.

Common mistakes

  • Writing 59 as 111011 and calling it BCD. That is pure binary. BCD of 59 is 0101 1001.
  • Accepting nibble 1010 as “A”. Hex A is 1010; 8421 BCD has no A.
  • Padding to 8 bits on the right (01011001 0000). Extra zero nibbles become extra 0 digits on decode.
  • Pasting hex FF and expecting 255 as BCD. FF is two invalid nibbles. Use hex to decimal first.
  • Mixing unpacked BCD (a byte per digit with 0000 in the high nibble) with this packed form.

0–9 BCD table

  • Each decimal digit and its 8421 nibble. 1010–1111 are omitted because they are invalid.
Digit8421 bits
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

Frequently Asked Questions

What is 59 in BCD?

0101 1001. Digit 5 is 0101, digit 9 is 1001. Pure binary of 59 is 111011.

Why is 1010 rejected?

1010 is 10, which is not a single 8421 digit. Valid nibbles are 0000–1001 only.

Is BCD the same as binary?

No. Binary 59 is 111011. BCD keeps each decimal digit in its own nibble, so 59 needs eight bits.

What is 9 in 8421?

1001. Weights 8+1. 1000 is 8; 1010 would be invalid, not “ten”.

Can I paste 0101 1001 with spaces?

Yes. Spaces and underscores are stripped. The bit length must still be a multiple of 4.

Does this encode Gray code?

No. Gray is the [Gray code converter](/tool/gray-code-converter/). BCD is decimal digits packed as 8421 nibbles.

Expert Guide for BCD Converter

View Blog
What Does 1011001 Mean in Binary? Binary to Decimal

What Does 1011001 Mean in Binary? Binary to Decimal

Short binary strings like 1011001 or 01011 are usually numbers, not letters. Learn to convert binary to decimal by hand, with a free converter to check.

Read Guide

Categories

Browse all FlashKit tools