Toolstia / BCD converter
BCD converter
Binary coded decimal stores each decimal digit in its own group of four bits. This tool converts a decimal number to BCD, or BCD bits back to a decimal number, in three common codes.
Binary coded decimal stores each decimal digit in its own 4 bit group. Standard BCD uses the plain binary value of the digit. Aiken (2421) weights the bits 2, 4, 2, 1 so that a digit and its nine's complement are bit inverses. Excess-3 adds 3 to each digit.
How it works
- Pick the direction and the code.
- Type the decimal number or the BCD bits.
- Read the result and copy it.
Standard BCD (8421)
Each digit is written as its plain 4 bit binary value, so 2024 becomes 0010 0000 0010 0100.
Aiken (2421)
The bits are weighted 2, 4, 2 and 1. The code for a digit and for its 9-complement are bit inverses of each other, which makes subtraction simple in hardware.
Excess-3
Each digit has 3 added before it is written in binary, so 0 becomes 0011 and 9 becomes 1100.
Where BCD is used
Digital clocks, calculators, seven segment displays, point of sale hardware and some financial systems that need exact decimal digits.
Questions
Is my number uploaded?
Everything happens in your browser, and nothing you enter is sent anywhere.
What is the hex view?
Packed BCD is often written as hex, because each hex digit matches one decimal digit in standard BCD.
Why do I get an invalid group error?
Not every 4 bit pattern is a digit. For standard BCD, 1010 to 1111 are not valid.