Enter the decimal digits (0–9) in the thousands, hundreds, tens, and ones place into the calculator to determine the BCD equivalent.

BCD Calculator

Enter all four digits (D1–D4) to encode into BCD, or enter a BCD value to decode back into digits.

BCD (Binary-Coded Decimal) Formula

The following formula gives the numeric value of a packed BCD word for a 4-digit decimal number (D1 D2 D3 D4), where each digit occupies 4 bits (one nibble). Variables:

Packed BCD (16-bit) = (D1 * 2^12) + (D2 * 2^8) + (D3 * 2^4) + D4
  • Packed BCD (16-bit) is the packed BCD code word (often shown as a 16-bit binary string or as a 4-digit hex value like 0x1011).
  • D1, D2, D3, D4 are the decimal digits in the thousands, hundreds, tens, and ones place respectively (each must be an integer from 0–9).

To calculate a BCD representation, convert each decimal digit to its 4-bit binary form (8421 code) and concatenate the groups. For example, digit 7 becomes 0111. Note that BCD is an encoding of decimal digits; it is not the same thing as re-computing the original decimal number from place values.

What is BCD (Binary-Coded Decimal)?

Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented separately in binary. The most common form uses 4 bits per decimal digit (often called “packed BCD” when two digits are stored per byte). Some systems store one digit per byte (sometimes called “unpacked BCD”), leaving the upper 4 bits as zero. In standard 8421 BCD, only the binary patterns for decimal digits 0 through 9 are valid.

How to Calculate BCD (Binary-Coded Decimal)?

The following steps outline how to calculate the BCD (Binary-Coded Decimal) for a 4-digit decimal number:


  1. Identify the digits D1, D2, D3, and D4 (thousands, hundreds, tens, ones), each from 0–9.
  2. Convert each digit to 4-bit binary (8421 BCD). For example: 0 → 0000, 1 → 0001, …, 9 → 1001.
  3. Concatenate the 4-bit groups in order: D1 then D2 then D3 then D4.
  4. (Optional) Express the packed 16-bit result in hexadecimal (4 hex digits).

Example Problem:

Use the following variables as an example problem to test your knowledge:

D1 = 1

D2 = 0

D3 = 1

D4 = 1

Convert each digit to 4-bit BCD and concatenate:

D1 = 1 → 0001, D2 = 0 → 0000, D3 = 1 → 0001, D4 = 1 → 0001

BCD (binary) = 0001 0000 0001 0001

BCD (hex) = 0x1011