Decimal to BCD Converter

The Decimal to BCD Converter encodes the number you type into Decimal Input as binary-coded decimal, giving each digit its own 4-bit binary nibble instead of reweighing the whole number. Click Convert and the nibbles appear in BCD (Binary) Output — switch on the grouped-nibbles option to keep each digit visually separate. Type a base-10 number into the decimal to binary converter and its binary representation appears in Binary Output within seconds.

What Is the Decimal to BCD Converter and How BCD Encoding Works

What is Binary-Coded Decimal (BCD)?

What is Decimal to BCD Converter? Binary-Coded Decimal (BCD) is a digital encoding scheme in which every individual decimal digit — 0 through 9 — is represented by its own fixed-width 4-bit binary group, often called a nibble. Rather than converting an entire number to a single base-2 value, BCD encodes each digit separately and places the resulting nibbles side by side. This preserves the natural structure of decimal numbers inside digital logic, making it straightforward to drive displays, perform decimal arithmetic, and interface with human operators without complex base-conversion steps. Use the text to binary converter to turn any string of text into its binary character codes for copying elsewhere.

For example, the decimal number 273 has three digits. Encoding each digit independently gives:

  • Digit 20010
  • Digit 70111
  • Digit 30011

The final BCD representation is therefore 0010 0111 0011 — three nibbles written in the same left-to-right order as the original decimal digits.

How to Use the Decimal to BCD Converter

How to Use the Decimal to BCD Converter? The tool above makes the conversion process completely effortless:

  • User inputs: Type any positive decimal integer into the input field. The tool accepts numbers up to fifteen digits long.
  • Convert button: Click Convert to trigger the calculation. Your BCD output appears instantly, displayed in clearly spaced 4-bit groups.
  • Random inputs (die icon): Click the die icon beside the input field to generate a random decimal number automatically — ideal for practising conversions and building intuition.
  • Clear functionality: Use the Clear button to reset the input and output fields so you can enter a new number without leftover values interfering.
  • Copy and download: Copy the generated BCD result as plain text, or download the solution as an image file to share with colleagues or include in coursework.

Working of Binary Coded Decimal — BCD Encoding Rules and Bit Patterns

Working of Binary Coded Decimal relies on one simple rule: map every decimal digit to its 4-bit equivalent, and concatenate the results. Because there are only ten valid decimal digits (0–9), only ten of the sixteen possible 4-bit patterns are used. The remaining six patterns — 1010 through 1111 (representing 10–15 in pure binary) — are invalid in standard BCD encoding and are sometimes called pseudo-tetrads or pseudo-tetrades.

BCD Encoding Rules

  • Each decimal digit occupies exactly 4 bits (one nibble).
  • Valid BCD patterns run from 0000 (decimal 0) to 1001 (decimal 9).
  • Invalid BCD patterns1010 to 1111 — do not represent any valid digit. If they appear in BCD data, they indicate an error or a reserved special purpose (such as a sign indicator or decimal-point marker in extended BCD variants).
  • Multi-digit decimals are encoded left to right, one nibble per digit, with no carry between digits.
  • The decimal point itself is not encoded as a nibble; instead, its position is tracked implicitly, using a fixed-point convention, or by assigning a pseudo-tetrad a special meaning.

Truth Table for Binary Coded Decimal

Truth Table for Binary Coded Decimal — the complete mapping of every valid decimal digit to its BCD code and binary breakdown:

Decimal DigitBCD CodeBinary Breakdown
000000×8 + 0×4 + 0×2 + 0×1 = 0
100010×8 + 0×4 + 0×2 + 1×1 = 1
200100×8 + 0×4 + 1×2 + 0×1 = 2
300110×8 + 0×4 + 1×2 + 1×1 = 3
401000×8 + 1×4 + 0×2 + 0×1 = 4
501010×8 + 1×4 + 0×2 + 1×1 = 5
601100×8 + 1×4 + 1×2 + 0×1 = 6
701110×8 + 1×4 + 1×2 + 1×1 = 7
810001×8 + 0×4 + 0×2 + 0×1 = 8
910011×8 + 0×4 + 0×2 + 1×1 = 9

Numbers with a Decimal Point

Handling fractional decimal values in BCD requires a deliberate strategy because the decimal point is not itself a binary digit. Three common approaches exist:

  • Pseudo-tetrad marker: Assign one of the six invalid patterns (e.g., 1010) to represent the decimal point position.
  • Fixed-point convention: Always encode a fixed number of digits before and after the point, padding with leading or trailing zeros as necessary. For instance, 5.7 stored as a two-digit-dot-one-digit fixed-point number becomes 0000 0101 . 0111.
  • Implicit position: Store the BCD digits without the point and record the point position separately in a control byte or header field.

Using the simple dot-separator notation, the number 5.7 in BCD is written as 0101 . 0111 — each side of the decimal point is encoded independently using the standard nibble mapping.

Step-by-Step BCD Conversion Examples

The following three worked examples cover every common scenario you will encounter when using the converter tool. Each example shows the Solution Steps in full so you can replicate the process by hand and verify your results. Designers building a color palette often turn to the hex color tint calculator to generate lighter shades of a base color.

Example: Single-Digit Decimal to BCD

Example: Convert decimal 7 to BCD.

  1. Identify the digit: The number 7 is a single decimal digit, so only one nibble is needed.
  2. Look up the 4-bit code: From the truth table, 7 maps to 0111 (0×8 + 1×4 + 1×2 + 1×1 = 7).
  3. Write the BCD output: No concatenation is required for a single digit.

Final BCD Result: 0111

Note: Standard binary would represent 7 as 111 (3 bits). BCD always uses 4 bits per digit for consistency, so the leading zero is retained.

Example: Multi-Digit Decimal to BCD

Example: Convert decimal 57 to BCD.

  1. Split into individual digits: 5 and 7.
  2. Encode digit 5: 0101
  3. Encode digit 7: 0111
  4. Concatenate in order: Place the nibble for 5 first, then the nibble for 7.
Decimal DigitBCD CodeBinary Breakdown
501010×8 + 1×4 + 0×2 + 1×1 = 5
701110×8 + 1×4 + 1×2 + 1×1 = 7

Final BCD Result: 0101 0111

Standard binary represents 57 as 111001 (6 bits), while BCD uses 8 bits — two nibbles — to preserve the decimal digit boundaries.

Example: Decimal with Fractional Part

Example: Convert decimal 5.7 to BCD.

  1. Separate integer and fractional parts: Integer digit = 5; fractional digit = 7.
  2. Encode 5: 0101
  3. Retain the decimal point separator: represented as . in the BCD output string.
  4. Encode 7: 0111
  5. Write the combined output: Place the integer nibble, the separator, then the fractional nibble.

Final BCD Result: 0101 . 0111

Each side of the decimal point is encoded independently. The point itself is not a binary pattern but a positional annotation that the receiving circuit or software must interpret according to a pre-agreed fixed-point or pseudo-tetrad convention.

Common Arithmetic Operations on BCD Numbers

Because BCD preserves decimal digit boundaries, arithmetic operations require special handling that differs from standard binary arithmetic. The four core operations — addition, subtraction, multiplication, and division — each have a defined procedure to ensure the result remains a valid BCD code.

1. BCD Addition

To add two BCD numbers, add the corresponding nibbles as if they were standard 4-bit binary values. If the sum of any nibble pair exceeds 9 (i.e., the result is greater than 1001), add the correction factor 0110 (decimal 6) to bring the result back into the valid BCD range. This step compensates for the six unused patterns (10101111).

BCD Addition Example: 45 + 37 = 82
  0100 0101   (45)
+ 0011 0111   (37)
-----------
  0111 1100   (7 12 — invalid BCD, digit exceeds 9)

  0111 1100   (Invalid result)
+ 0000 0110   (Add correction factor 0110)
------------
  1000 0010   (82 — valid BCD result)

The lower nibble produced 12 (binary 1100), which is an invalid BCD pattern. Adding the correction factor 6 converts it to a carry plus 2, yielding the correct answer 1000 0010 (82 in BCD).

2. BCD Subtraction

BCD subtraction follows the same digit-by-digit approach. If a digit being subtracted is larger than the digit above it, borrow from the next higher nibble and apply a correction. When the difference is a valid BCD digit (0–9), no correction is needed.

BCD Subtraction Example: 47 − 23 = 24
  0100 0111   (47)
- 0010 0011   (23)
-------------
  0010 0100   (24 — valid BCD result)

Final BCD Result: 0010 0100, representing decimal 24.

3. BCD Multiplication

BCD multiplication is handled by converting the BCD digits to their binary equivalents, performing standard binary multiplication, and then converting the binary product back to BCD. This approach avoids the complexity of direct BCD multiplication logic.

BCD Multiplication Example: 5 × 3 = 15
    0101   (5 in binary)
×  0011   (3 in binary)
---------
  0000 1111   (15 in binary)

Convert 15 to BCD:
1 → 0001
5 → 0101
15 in BCD: 0001 0101

Final BCD Result: 0001 0101, representing decimal 15.

4. BCD Division

BCD division mirrors the multiplication process: convert both operands to binary, perform binary division, and convert the quotient back to BCD. Any remainder must also be converted back to BCD if a fractional BCD result is required.

BCD Division Example: 18 ÷ 3 = 6
  0001 1000   (18 in binary)
÷     0011   (3 in binary)
------------
  0000 0110   (6 in binary)

Convert 6 to BCD: 6 → 0110

Final BCD Result: 0110, representing decimal 6.

BCD Variants and Formats — Packed, Unpacked, and Standard Binary Comparison

BCD is not a single monolithic format. Depending on the hardware platform and storage requirements, designers choose between two principal variants of BCD — or opt for standard binary when storage efficiency takes priority.

1. Packed BCD

Packed BCD stores two decimal digits in a single byte (8 bits) by using the high nibble for the tens digit and the low nibble for the units digit. This halves the memory footprint compared to unpacked BCD while retaining the digit-boundary advantages of BCD encoding. For example, the decimal number 93 is stored as 10010011: the first nibble 1001 encodes 9 and the second nibble 0011 encodes 3. IBM mainframes and COBOL programs use packed BCD extensively for financial record storage.

2. Unpacked BCD

Unpacked BCD allocates one full byte per decimal digit. The lower nibble holds the BCD digit code, while the upper nibble is either zeroed out (0000) or used to carry a sign indicator. Although unpacked BCD consumes twice the memory of packed BCD, it simplifies processing in systems where each digit must be accessed, manipulated, or displayed in isolation.

BCD vs. Standard Binary

The key difference between BCD and standard binary is how many bits are required to represent the same numeric value. Standard binary converts the entire decimal number to a single base-2 value, using only as many bits as necessary. BCD always allocates 4 bits per decimal digit, regardless of whether those bits could be reduced. This leads to larger representations but dramatically simpler decimal-display and decimal-arithmetic logic.

FormatBits per Decimal DigitExample: 93Typical Use CaseStorage Efficiency
Packed BCD4 bits10010011 (1 byte)Financial software, COBOL databases, POS systemsModerate — two digits per byte
Unpacked BCD8 bits00001001 00000011 (2 bytes)Digit-by-digit display, simple microcontroller I/OLow — one digit per byte
Standard Binary~3.32 bits (log₂10)1011101 (7 bits)General-purpose computation, memory-constrained systemsHigh — compact representation

Where BCD Is Used: Real-World Applications of Binary-Coded Decimal

Despite the rise of floating-point arithmetic and high-density binary storage, BCD remains an active standard across several industries because it eliminates the translation overhead between human-readable decimal and machine-internal binary.

1. Digital Displays

1. Digital Displays — Seven-segment LED and LCD displays in clocks, stopwatches, calculators, multimeters, and digital thermometers decode BCD directly. A dedicated BCD-to-seven-segment decoder IC (such as the 7447 or CD4511) accepts a 4-bit BCD nibble and drives the correct segments to show the corresponding decimal digit, entirely eliminating software-based number-to-character conversion.

2. Embedded Systems

2. Embedded Systems — Microcontrollers that must interact with human operators through decimal keypads or numeric readouts often store internal state variables in BCD. This strategy avoids run-time conversion, reduces code complexity, and lowers the risk of rounding artefacts in safety-critical or timing-sensitive embedded applications such as industrial timers and process controllers.

3. Data Conversion and Storage

3. Data Conversion: Financial and banking software relies on BCD (particularly packed BCD) to store monetary amounts without the floating-point rounding errors inherent in IEEE-754 representations. The classic example is that the value 7.1 cannot be expressed exactly in standard binary floating-point, yet it converts to BCD code without any loss of precision. Barcode scanners and RFID readers also use BCD internally when encoding numeric product identifiers.

4. Arithmetic Operations in Hardware

Dedicated BCD arithmetic units are embedded in older CPUs (including the Intel x86 family's DAA and DAS instructions), programmable logic controllers (PLCs), and mainframe processors. These units perform addition and subtraction directly on BCD values, using built-in correction logic to handle nibble overflow, which simplifies the hardware design for applications that live entirely in the decimal domain.

5. Control Systems

5. Control Systems — Industrial control panels, building-management systems, and SCADA interfaces frequently display process variables (temperatures, pressures, flow rates) as decimal numbers on BCD-driven readout panels. BCD allows the control logic to output numeric data directly to the display driver without a separate binary-to-decimal conversion stage, reducing system latency and component count.

Advantages and Limitations of BCD Representation

Understanding both sides of BCD helps you decide when to choose it over standard binary — and when to avoid it.

Advantages of BCD

  • Easy decimal conversion: Converting between BCD and decimal is trivial — group or split nibbles, with no modular arithmetic required.
  • No rounding errors for decimal fractions: BCD encodes decimal values such as 0.1 or 7.1 exactly, unlike IEEE-754 floating-point which introduces tiny representation errors.
  • Human-readable debugging: BCD bit patterns map directly onto decimal digits, making it easy to read and verify values during hardware or software debugging sessions.
  • Simple display logic: Each nibble feeds directly into a BCD-to-seven-segment decoder without any intermediate computation, reducing circuit complexity and power consumption.
  • Legacy system compatibility: Mainframe computers and older databases store data in packed BCD; understanding BCD is essential for maintaining and migrating these systems.

Limitations of BCD

  • 1. Inefficient Use of Memory — BCD uses approximately 20% more bits than pure binary for the same numeric range. A 4-bit nibble can encode 16 values, but BCD only uses 10, wasting 37.5% of the available bit patterns in each nibble.
  • 2. Complex Arithmetic Operations — Addition and subtraction require correction steps (adding or subtracting the correction factor 0110) whenever a nibble sum exceeds 9. These extra steps are not needed in standard binary arithmetic.
  • 3. Slower Processing Speed: The need for correction and validation logic in each nibble adds computational latency. BCD operations run noticeably slower than equivalent binary operations on general-purpose processors.
  • 4. Limited Range: For a given bit width, BCD encodes far fewer distinct values than standard binary. An 8-bit byte can represent 256 binary values but only 100 BCD values (00–99), limiting the numeric range available to BCD-based systems without expanding the bit width.
  • 5. Hardware Overhead — Implementing BCD arithmetic in digital logic requires specialised correction circuits or software routines. This additional hardware increases chip area, power draw, and design complexity compared to binary-only implementations.

BCD and Invalid Bit Patterns — Understanding Pseudo-Tetrades

Of the 16 possible 4-bit combinations, BCD only legitimately uses 10. The six unused patterns — 1010 (10), 1011 (11), 1100 (12), 1101 (13), 1110 (14), and 1111 (15) — are collectively called pseudo-tetrades or pseudo-tetrads. In standard BCD arithmetic, encountering one of these patterns signals either a calculation error or an overflow condition that requires the correction factor to be applied.

Some extended BCD systems deliberately assign pseudo-tetrades a special meaning: for example, one pattern might indicate a positive sign, another a negative sign, and another the position of a decimal point. This technique allows a single BCD stream to carry both numeric data and formatting metadata without needing a separate control channel. However, any system that uses pseudo-tetrades for special purposes must document those assignments explicitly, because different standards assign different meanings to these patterns.

When you use this tool on this page, the output will never contain a pseudo-tetrad, because it encodes only valid decimal digits (0–9). If you are decoding externally sourced BCD data and encounter one of these patterns, consult the originating system's documentation to determine whether the pattern represents an error or a special symbol.

Converting BCD Back to Decimal — Reversing the Process

Reversing a BCD representation to recover the original decimal number is just as straightforward as the forward conversion. The process requires no arithmetic — only grouping and table lookup:

  1. Group the bits into 4-bit nibbles from left to right. For example, 0010 0101 0100 splits into 0010, 0101, and 0100.
  2. Convert each nibble to its decimal equivalent using the BCD truth table: 0010 → 2, 0101 → 5, 0100 → 4.
  3. Concatenate the decimal digits in the same left-to-right order: 2, 5, 4 → decimal number 254.

If any nibble falls in the pseudo-tetrade range (10101111), the BCD data is either corrupt or uses an extended encoding that must be handled according to the originating system's specification. You can use our BCD to Decimal Converter (linked below) to automate this reverse process instantly.

Related Conversion Tools for Binary-Coded Decimal and Digital Number Systems

If you are working with BCD and related binary codes, the following tools complement the decimal to bcd converter and cover the full range of conversions you are likely to need:

  • BCD to Decimal Converter — Reverse the process: convert BCD nibble groups back to their original decimal representation instantly.
  • Decimal to Excess-3 Converter — Encode decimal digits using the self-complementing Excess-3 (XS-3) code, where each digit is represented as its BCD value plus 3.
  • BCD to Excess-3 Converter — Translate directly between BCD and Excess-3 without passing through the decimal stage.
  • Excess-3 to Decimal Converter — Decode Excess-3 encoded values back to human-readable decimal numbers.
  • BCD Addition Calculator — Perform digit-by-digit BCD addition with automatic correction factor application and step-by-step solution output.
  • Even Parity Calculator — Compute the even parity bit for binary data words, essential for error detection in digital communication and storage systems.
  • Gray Code to Binary Converter — Convert Gray code (reflected binary) values to standard binary, commonly used in rotary encoders and error-minimising digital circuits.
  • Decimal to ASCII Converter — Translate decimal character codes into their ASCII equivalents, useful for text encoding, protocol analysis, and embedded firmware development.