Decimal to BCD converter
BCD writes each decimal digit on its own in four bits, as used in digital clocks, seven-segment displays and logic circuits.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter decimal number (digits only) and code.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Each digit 0 to 9 becomes four bits: in 8421 its binary value (7 = 0111), in Excess-3 the digit plus 3 (7 = 1010), and in 2421 digits 0 to 4 as binary and 5 to 9 as 1011 to 1111.
Example
Inputs: Decimal number (digits only) = 2026, Code = Standard 8421 BCD. Result: Code, one group per digit: 0010 0000 0010 0110; Total bits: 16.
2026
0010 0000 0010 0110
Limits and caveats
- Accepts non-negative whole numbers only and adds no sign nibble, since sign formats differ between systems.
- Leading zeros are kept and encoded, because BCD works digit by digit.
Questions about this tool
How is BCD different from plain binary?
45 in plain binary is 101101, but in BCD each digit stands alone: 0100 for 4 and 0101 for 5.
What is Excess-3 good for?
It is self-complementing: flipping the bits of a digit gives the code for 9 minus that digit, which made subtraction easier in early circuits.
Why do 1010 to 1111 never appear in standard BCD?
A single decimal digit never goes above 9, which is 1001, so the six higher patterns are unused.
