BCD converter

Type a decimal number to see it as binary-coded decimal: one 4-bit nibble per digit, packed two digits per byte or unpacked one digit per byte. Or paste BCD bits and read the decimal number.

Decimal digits, or BCD bits (0 and 1, spaces allowed). Packed BCD needs groups of 4 bits per digit, unpacked groups of 8.
Packed BCD (8421) bits0001 0010 0011 0100
Packed BCD as hex
0x1234
Unpacked BCD bits
0000 0001 0000 0010 0000 0011 0000 0100
Unpacked BCD as hex bytes
01 02 03 04
Decimal
1234

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose Decimal digits to encode, or Packed or Unpacked BCD bits to decode.
  2. Type the value. All forms update at once.
  3. Copy the packed or unpacked bits.

How it works

Each decimal digit d (0 to 9) is written as its 4-bit binary value. Packed BCD joins the nibbles; unpacked BCD puts each nibble in the lower half of a byte with 0000 above it. When decoding, every nibble must be at most 9 (1001).

Example: 1234 is 0001 0010 0011 0100 packed, which is 0x1234, and 0000 0001 0000 0010 0000 0011 0000 0100 unpacked.

Tips and common mistakes

  • Signs are not handled: real systems add a sign nibble (often C or D in packed formats) that is not included here.
  • 907 shows as 0x0907 because the hex view fills whole bytes; the bit view has just three nibbles.
  • Spaces in the input are ignored, so you can paste grouped bits.

Frequently asked questions

What is BCD?

Binary-coded decimal stores each decimal digit in its own 4-bit group using the plain binary value 0000 to 1001. The number 1234 is 0001 0010 0011 0100. Only the codes 1010 to 1111 are unused.

What is the difference between packed and unpacked BCD?

Packed BCD puts two digits in each byte (one per nibble), so 1234 is the bytes 12 34. Unpacked BCD uses a whole byte per digit with the upper nibble zero, so 1234 is 01 02 03 04.

How does BCD differ from binary?

Plain binary stores the whole value as one number: 1234 is 0100 1101 0010. BCD stores the digits separately, so it takes more bits but converts to and from decimal digits without arithmetic. This is why it is used in clocks, displays and some financial hardware.

What is 8421?

It names the bit weights in a nibble: 8, 4, 2 and 1. Other BCD codes such as Excess-3 or Aiken use different weights and are not covered here.

Why is the hex form the same as the decimal digits?

A nibble is one hex digit, and BCD digits only use 0 to 9. So packed BCD read as hex shows the original decimal digits. An odd digit count gets a leading 0 in the hex view to complete the last byte.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.