October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

What Is Binary-Coded Decimal (BCD)? Definition, Examples, and Formats

Binary-coded decimal encodes each decimal digit separately. See how 59 becomes 0101 1001 in BCD and how packed, unpacked, and signed formats work.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Binary-coded decimal (BCD) represents a decimal number by encoding each decimal digit separately in binary. In common four-bit BCD, the digits 0 through 9 map to 0000 through 1001. For example, decimal 59 is 0101 1001 in BCD—not the ordinary binary integer representation 00111011.

What does BCD mean?

BCD stands for binary-coded decimal. It is a way of representing decimal numbers in which each decimal digit gets its own binary code. The digit boundaries remain visible in the encoded value, unlike an ordinary binary integer, which represents the whole number as one value.

In the common natural BCD mapping, each digit uses four bits, also called a nibble:

Decimal digit Four-bit BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

The six remaining four-bit patterns, from 1010 through 1111, are not decimal digits in this mapping. A particular format may assign some of them special meanings, so their interpretation depends on that format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Decimal Computation.
  • Used Book in Good Condition

How do you write a number in BCD?

Convert each decimal digit independently to its four-bit code, then place the groups in the same order as the original digits. For decimal 59:

  1. Convert the digit 5 to 0101.
  2. Convert the digit 9 to 1001.
  3. Join the digit groups: 0101 1001.

That result is BCD for 59. By contrast, 00111011 is 59 written as an ordinary binary integer. The two bit strings represent the same decimal quantity under different encoding rules; splitting BCD into four-bit groups recovers its decimal digits directly.

What is the difference between packed and unpacked BCD?

“Packed” and “unpacked” describe how BCD digits are laid out in storage, not a different rule for converting a decimal digit to BCD. Intel’s architecture manual describes these layouts as follows:

Layout Digits per storage unit Description
Packed BCD Two digits per byte Each digit occupies one half-byte; the high half-byte holds the more significant of the two digits.
Unpacked BCD One digit per byte The low four bits carry the digit value in the Intel description.

These are layouts documented for the Intel architecture; other formats or implementations may define additional details. Intel also describes a specialized 80-bit packed decimal integer format, which is one architecture-specific form rather than the definition of all BCD.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
PIC Projects for Non-Programmers
  • Used Book in Good Condition

How does signed BCD work?

Unsigned four-bit BCD represents digits from 0 to 9; representing a signed number requires a format that specifies how the sign is stored. There is no single sign convention implied by the basic BCD digit mapping.

For example, IBM’s Open XL C/C++ documentation describes BCD built-ins in which digit and sign fields use four bits, with digits in contiguous arrays and a sign nibble at the end. It lists accepted sign codes and describes behavior for IBM processor targets. Those sign codes and rules belong to that IBM implementation; do not assume they apply to every BCD format. See IBM’s BCD built-in documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How is BCD different from ordinary binary?

Ordinary binary represents the entire integer using base-two place values. BCD instead gives each decimal digit its own code. This makes decimal digit positions directly readable in BCD, while straightforward four-bit-per-digit BCD uses more bits for many values than ordinary binary representation.

BCD’s direct digit structure can be useful when a system needs to retain decimal digits as digits, but storage and performance trade-offs depend on the system and the format. The available sources do not establish a universal speed comparison or say that one representation is always preferable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Are there more compact BCD encodings?

Yes. Straightforward four-bit BCD spends four bits on each decimal digit, but other encodings can store decimal digits more densely. IBM Research describes Chen–Ho encoding as a lossless method for encoding three BCD digits in 10 bits. It is a compression technique related to BCD, not the basic four-bit-per-digit mapping. IBM Research also notes an improvement that is not limited to groups of three digits. See IBM Research’s page for M. F. Cowlishaw’s paper, published May 1, 2002.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.