Zero Signup ToolsFree browser tools

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.

Try:
8421 output
0010 0000 0010 0110

Output size

Digits

4

BCD bits

16

Bytes

2

Digit by digit

Each decimal digit and the 4-bit 8421 group it maps to.

Digit8421 code
20010
00000
20010
60110

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

Digit8421XS-32421
0000000110000
1000101000001
2001001010010
3001101100011
4010001110100
5010110001011
6011010011100
7011110101101
8100010111110
9100111001111

How to use

  1. Choose a direction: Decimal to BCD to encode a number, or BCD to decimal to read bits back into a number.
  2. 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.
  3. 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.
  4. 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.
  5. 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

All tools
All toolsDeveloper Tools