Developer Tools

BCD converter.

Convert decimal to binary-coded decimal and back, in packed (two digits per byte) or unpacked form, or add two BCD numbers digit by digit with the +6 correction. Runs in your browser.

Advertisement

Input

Result

Enter a value, then press Calculate.

How BCD works

Worked examples

DecimalPacked BCDUnpacked BCD
25900000010 0101100100000010 00000101 00001001
911001000100001001 00000001
409601000000 1001011000000100 00000000 00001001 00000110

8 + 5: 1000 + 0101 = 01101 (13, not a digit), add 0110 to get 0011 with a carry, so the answer is 13 = 0001 0011.

Where BCD is used

BCD avoids binary rounding when handling decimal quantities, so it shows up in digital clocks, calculators, seven-segment displays, financial hardware and legacy mainframe data. The x86 instruction set has packed BCD adjust instructions (DAA, DAS) for 32-bit code. For converting other bases see the Binary Converter; to compare a signed number format see two's complement.

Runs in your browser. Nothing is sent anywhere.

FAQ

What is BCD (binary-coded decimal)?

BCD stores each decimal digit as its own 4-bit binary group, so 259 becomes 0010 0101 1001 instead of the single binary number 100000011.

What is the difference between packed and unpacked BCD?

Packed BCD puts two digits in each byte. Unpacked BCD uses one byte per digit, with the high four bits set to 0000.

Why does BCD addition add 6?

A 4-bit group can hold 0 to 15 but BCD only uses 0 to 9. When a digit sum is above 9, adding 6 skips the six unused codes and produces the carry into the next digit.

Is 1010 a valid BCD digit?

No. The groups 1010 to 1111 (10 to 15) are not decimal digits, so this converter reports them as invalid and tells you which nibble it found.

Does BCD handle negative numbers or decimals?

Plain BCD does not. Real systems add a sign nibble or sign byte and track the decimal point separately; those conventions differ between platforms, so this tool converts non-negative whole numbers only.

Sources

Sources retrieved October 2026.

Advertisement
Advertisement