Developer Tools
BCD Converter
Convert decimal to BCD and BCD back to decimal in your browser. Supports 8421, Excess-3, and Aiken 2421, packed or unpacked, with per-digit breakdown.
Binary-coded decimal converter
Direction
Encoding
Weights 8 4 2 1. Each nibble is the digit in plain binary. This is what BCD means by default.
Bit grouping
One space between every 4-bit digit. Easiest to read.
Output size
Digits
4
BCD bits
16
Bytes
2
Digit by digit
Each decimal digit and the 4-bit 8421 group it maps to.
| Digit | 8421 code |
|---|---|
| 2 | 0010 |
| 0 | 0000 |
| 2 | 0010 |
| 6 | 0110 |
BCD vs pure binary
In pure binary the whole number is one value, so 42 is 101010. In BCD each decimal digit keeps its own nibble, so 42 is 0100 0010: a 4 then a 2. BCD uses more bits, but turning a digit into a 7-segment or LCD pattern is a direct lookup with no division, which is why displays, clock chips, and metering hardware still use it.
Encoding cheat sheet
| Digit | 8421 | XS-3 | 2421 |
|---|---|---|---|
| 0 | 0000 | 0011 | 0000 |
| 1 | 0001 | 0100 | 0001 |
| 2 | 0010 | 0101 | 0010 |
| 3 | 0011 | 0110 | 0011 |
| 4 | 0100 | 0111 | 0100 |
| 5 | 0101 | 1000 | 1011 |
| 6 | 0110 | 1001 | 1100 |
| 7 | 0111 | 1010 | 1101 |
| 8 | 1000 | 1011 | 1110 |
| 9 | 1001 | 1100 | 1111 |
How to use
- Choose a direction: Decimal to BCD to encode a number, or BCD to decimal to read bits back into a number.
- Pick the encoding: BCD 8421 (the natural default), Excess-3, or Aiken 2421, using the cheat sheet at the bottom if you are unsure which one your hardware uses.
- For decimal to BCD, type a whole number and choose how the bits are grouped: per digit, packed two digits per byte, unpacked one digit per byte, or no spaces.
- For BCD to decimal, paste the bits with or without spaces; invalid groups such as 1010 in 8421 are flagged with the exact nibble and reason.
- Read the result, check the digit-by-digit or nibble-by-nibble table, then use the copy button to copy the output.
About this tool
BCD Converter turns decimal numbers into binary-coded decimal and back, entirely in your browser. Binary-coded decimal, or BCD, is a way of storing a number that keeps each decimal digit on its own group of four bits (a nibble) instead of writing the whole value in pure binary. That is the key difference from a base converter: pure binary writes 42 as 101010, while BCD writes it as 0100 0010, a 4 nibble followed by a 2 nibble, so the human-readable digits survive intact. BCD is still everywhere that digits must map straight to a display or a register without dividing: 7-segment and LCD readouts, real-time clock (RTC) chips, calculators, point-of-sale and metering hardware, and many embedded and FPGA designs, because converting a BCD nibble to a display segment pattern is a direct lookup. This tool covers the three encodings that actually appear in hardware and digital-logic courses. BCD 8421, the natural and default form, uses weights 8 4 2 1 so each nibble is simply the digit in plain binary, and the codes 1010 through 1111 are illegal because no decimal digit needs them; the decoder flags exactly which nibble breaks that rule. Excess-3, written XS-3, stores each digit as the digit plus three, which makes it self-complementing (the 9s complement of a digit is the bitwise inverse of its code) and gives it no all-zero code, both of which simplified arithmetic in early machines. Aiken 2421 is a weighted self-complementing code with weights 2 4 2 1, used where 9s-complement arithmetic was wanted while keeping place weights. It also handles the two ways nibbles are laid out in memory: unpacked BCD puts one digit per byte with a zero high nibble, the simple wasteful form, while packed BCD stores two digits per byte, so 42 becomes the single byte 0x42, which is the dense layout used by RTC registers and financial formats; an odd digit count is padded with a leading zero nibble so the bytes stay whole. The decimal-to-BCD direction shows the bit string in your chosen grouping, the total bit and byte size, and a digit-by-digit table so you can see exactly which nibble each digit produced. The BCD-to-decimal direction accepts bits with or without spaces (and ignores stray separators or a 0b prefix), splits them into nibbles, validates every group against the selected encoding, rebuilds the decimal value, and reports the precise nibble and reason when a code is not a legal digit, rather than guessing. A cheat sheet lists all ten digits in 8421, XS-3, and 2421 side by side. Common uses include checking homework and exam answers in a digital electronics class, preparing constants for microcontroller and FPGA code, reading values out of an RTC or sensor datasheet, and understanding why a display driver expects BCD rather than binary. Everything, the digit mapping, the encoding tables, the grouping, and the validation, runs locally in your browser, so nothing you type is uploaded, logged, or stored.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
Gray Code Converter
Convert between binary, decimal, and Gray code with a live bit view and step-by-step XOR breakdown.
Open tool
DeveloperTwo's Complement Calculator
Signed and unsigned integer to binary, hex, and octal at every common bit width.
Open tool
DeveloperIEEE 754 Converter
Decimal to IEEE 754 bits and back, for single (32-bit) and double (64-bit) floats.
Open tool
ConverterNumber Base Converter
Binary, octal, decimal, hex, and custom-base conversion with two's complement.
Open tool
ConverterBinary Translator
Bidirectional text and binary translation with UTF-8 byte breakdown.
Open tool