Hex to BCD Converter
Find the BCD (binary-coded decimal) representation of a hex value — each decimal digit packed into its own nibble, the format RTC chips and BCD displays use.
How to Convert Hex to BCD
Convert the hex value to its plain decimal number first, then treat each digit of that decimal number as its own 4-bit nibble. The result reads identically to the decimal value, just represented as packed nibbles instead of a binary number.
Hex to BCD Example, Step by Step
7B = 123 (BCD)
0x7B = 123 in BCD
7B hex = 123 decimal Pack each digit into a nibble: 1 -> 0001 2 -> 0010 3 -> 0011
| Step | Description | Result |
|---|---|---|
| Convert to decimal | 0x7B = 123 (decimal) | 123 |
| Split into digits | 1, 2, 3 | 3 digits |
| Pack each into a nibble | 0001, 0010, 0011 | 123 (BCD) |
Notice the BCD result and the decimal number look identical — that's the whole point of BCD, it's a binary format that reads as decimal at a glance.
Common Mistakes When Converting Hex to BCD
- Confusing BCD with plain hex — a BCD value never contains A-F, even though it's written with digit characters.
- Forgetting to convert to decimal first before splitting into nibbles.
- Assuming BCD is more compact than hex — it's actually less efficient per bit.
Frequently Asked Questions
What is BCD, exactly?
Binary-coded decimal packs one decimal digit (0-9) into each 4-bit nibble, instead of letting a nibble represent a full hex digit (0-F). It trades some efficiency for numbers that stay easy to read and display digit by digit.
How do you convert hex to BCD?
Convert the hex value to its plain decimal number, then read each decimal digit as if it were its own nibble — 123 in decimal becomes the BCD value with nibbles 1, 2, 3 in sequence.
Why does the BCD value look like a decimal number written in hex digits?
Because that's exactly what it is — BCD nibbles only ever hold 0-9, so a BCD value never contains A-F, and visually looks identical to writing the decimal number using hex notation.
Where is BCD actually used?
Real-time clock (RTC) chips, digital displays, and some embedded systems store values in BCD because it converts directly to a readable digit display without extra math.
What's the downside of BCD compared to plain hex?
It wastes some bits — a nibble can represent 16 values (0-F) but BCD only uses 10 of them (0-9), so BCD-encoded numbers take more storage than the equivalent plain hex value.
Is BCD the same as packing two digits per byte?
That's exactly what "packed BCD" means in hardware — two BCD nibbles (two decimal digits) fit in one byte, which is how most real BCD hardware stores values.