BCD to Decimal Converter
BCD to Decimal Converter. Paste your value into BCD (Binary) Input and the BCD to Decimal Converter instantly returns its Decimal Output. When you need uppercase A-F letters in your hex output, the binary to hex converter has a toggle built in for that.
Need to read a string of 0s and 1s as an everyday number? The BCD to decimal converter splits your input into 4-bit groups and turns each group into one decimal digit, so 0110 0100 1000 0001 becomes 6481 in a single click. It is a quick way to decode binary coded decimal values from a meter, a clock chip or a homework problem, and this guide explains exactly what happens behind the result.
How the BCD to Decimal Converter Works
In binary coded decimal, every decimal digit gets its own 4-bit binary code. Instead of converting the whole number to base-2, the converter reads the input one group of four bits at a time, looks up the decimal digit each group stands for, and writes the digits side by side in the same order. Nothing is added, multiplied or carried between groups, which is why the conversion is easy to do by hand and easy for digital hardware to perform. Use the ip address to hex converter when a network log or firmware config expects an IPv4 address written out in hex.
The rule is a position-by-position lookup, where each four-bit group \(g_i\) is read as an ordinary binary number between 0 and 9:
$$d_i = 8b_3 + 4b_2 + 2b_1 + 1b_0$$
Here \(b_3 b_2 b_1 b_0\) are the four bits of the group, from left to right. The positional value of each bit inside the group is 8, 4, 2 or 1, which is why BCD is also called 8-4-2-1 code. The decimal number is then the digits \(d_n \ldots d_1 d_0\) written one after another.
BCD Encoding Table
Only ten of the sixteen possible 4-bit patterns are used. This encoding table is all you need to decode any valid BCD number:
| Decimal digit | 4-bit BCD code | Bit weights (8-4-2-1) |
|---|---|---|
| 0 | 0000 | 0 + 0 + 0 + 0 |
| 1 | 0001 | 0 + 0 + 0 + 1 |
| 2 | 0010 | 0 + 0 + 2 + 0 |
| 3 | 0011 | 0 + 0 + 2 + 1 |
| 4 | 0100 | 0 + 4 + 0 + 0 |
| 5 | 0101 | 0 + 4 + 0 + 1 |
| 6 | 0110 | 0 + 4 + 2 + 0 |
| 7 | 0111 | 0 + 4 + 2 + 1 |
| 8 | 1000 | 8 + 0 + 0 + 0 |
| 9 | 1001 | 8 + 0 + 0 + 1 |
Why Four Bits Per Digit
Four bits can hold 16 different values, and ten are enough for the digits 0 to 9. Each group is called a nibble, half of a byte, so two digits fit in one byte. The six unused patterns are the reason a decoder must check its input, which the section on invalid BCD input covers below.
BCD to Decimal Conversion: A Worked Example
Take the input 0110 0100 1000 0001. It has sixteen bits, so it is read as four nibbles, each decoded on its own: The fastest way to decode a hex swatch into RGB numbers is to enter it into the hex to rgb converter and hit Convert.
| Position | Nibble | Calculation | Decimal digit |
|---|---|---|---|
| 1st (thousands) | 0110 | 4 + 2 | 6 |
| 2nd (hundreds) | 0100 | 4 | 4 |
| 3rd (tens) | 1000 | 8 | 8 |
| 4th (ones) | 0001 | 1 | 1 |
Writing the digits in order gives 6481. Compare that with plain base-2: the number 6481 is 1100101010001 in standard binary, which is 13 bits instead of 16 and looks nothing like the BCD pattern. That gap is why you should always know which of the two a bit string is meant to be before you decode it.
How to Use the BCD to Decimal Converter
The tool takes one input and returns one result, but a few habits make it faster and help you learn the method: The hex to base16 converter reformats a pasted hex value, since hex and Base16 are the same numeral system underneath.
- Type or paste your BCD digits into the input box. Spaces between nibbles are fine, and a plain run of bits is split into groups of four from the right.
- Click the Convert button to see the decimal value together with the solution steps, one line per nibble.
- Use the random option to load a sample BCD value and practise decoding it yourself before you check the answer.
- Clear the field before entering a new value, and copy the result when you need it in a report or an assignment.
- Read the step-by-step output once; after a few examples you can decode short values in your head with the table above.
This free online tool is a plain calculator for one job: decoding. Press the random option a few times and you will see that every valid input gives exactly one answer, which makes the BCD to decimal converter a useful self-check when you practise. Pair it with a random decimal to BCD exercise: encode a number by hand, then decode your own answer to confirm the round trip.
If your input length is not a multiple of four, pad the left side with zeros, because a leading 0000 group adds a leading zero to the decimal digits and does not change the value.
Debugging a Clock Register With a BCD to Decimal Calculator
A firmware engineer has dumped three timekeeping registers from a real-time clock chip over I2C, and the time on the display looks wrong. The datasheet says the chip stores seconds, minutes and hours in packed BCD, so she needs to turn raw bit strings into the numbers a person reads.
She enters the first byte, 0101 1001, into the BCD decoder. The nibbles are 0101 (5) and 1001 (9), so the seconds register reads 59. The minutes byte 0110 0010 decodes to 6 and 2, which is 62. Both nibbles are legal digits, so the converter does not flag the input, yet the datasheet's range for minutes is 00 to 59. A decimal 62 means the value is valid BCD but impossible as a clock reading.
- Seconds: 0101 1001 = 59 (inside 00 to 59)
- Minutes: 0110 0010 = 62 (outside 00 to 59)
- Hours: 0010 0011 = 23 (inside 00 to 23 in 24-hour mode)
The decoded numbers settle the question. Hours and seconds are fine, so the clock is running; only the minutes byte is off. She rereads the registers with the address pointer reset to 0x00 and the minutes byte now returns 0100 0111, which decodes to 47 and fits between the other two values. The first read had caught the register mid-update at a rollover, so the next step is to read all three bytes in one burst transfer. A bit-pattern dump alone never showed that, but one decimal result per register did. The tool only decodes the nibbles; judging whether 62 is a legal minute stays with the reader.
BCD Code to Decimal: Truth Table and Bit-by-Bit Check
If you prefer to verify a result without any tool, build the truth table of a single nibble once and reuse it. Each row lists the four bits, the weights that are switched on and the digit they add up to, which is exactly what the encoding table above shows. A bit-by-bit check of 1000 works like this: the leftmost bit carries weight 8 and the other three are off, so the digit is 8. The same check on 0111 adds 4, 2 and 1 to give 7.
That BCD digit logic is also what a hardware decoder implements with a handful of logic gates. The tool you use online repeats the same step-by-step conversion in software: it splits the binary sequence, checks every group against the ten valid patterns, and joins the results. A short conversion table printed beside your answer is the quickest way to spot a mistyped bit, because a single flipped bit usually produces a different digit or an invalid group.
BCD Representation in Memory
The same BCD representation can be viewed as a decimal number, a bit pattern or a hexadecimal string, and the three views are easy to mix up. In packed form the digits 6, 4, 8 and 1 appear as the hex string 6481 even though the value is not 25,729.
When you read a hex dump of BCD data, copy the hex digits straight into the converter as nibbles; the packed and unpacked layouts are compared in the decimal to BCD section.
Accuracy and Precision When You Decode Binary-Coded Decimal
A computer that stores money or measurements as binary-coded decimal keeps every decimal digit exactly as it was entered, so a display can show 0.10 without rounding noise. This accuracy is the main reason the format survives in meters, tills and clocks. Precision, meanwhile, is set by how many nibbles the register has, since each extra nibble adds one more decimal place or one more leading position.
Because the BCD conversion itself involves no arithmetic, the decoded value is exact, and any wrong answer almost always comes from the input: a dropped zero, a group of three bits, or an input that was never BCD at all. Other number systems, from octal to hexadecimal, use their own digit sets, and each number system needs its own reading rule, and a BCD code to decimal lookup is simpler than all of them because it needs only ten entries. A BCD converter is therefore the safest first stop when a register dump looks suspicious. Before decoding, confirm that the input is in proper BCD form, a multiple of four bits with no 1010 to 1111 groups, and the BCD to decimal converter handles the rest.
Invalid BCD Input and Pseudotetrades
The patterns 1010 through 1111 (decimal 10 to 15) do not stand for any digit. They are called pseudotetrades, and a valid BCD number never contains one. The converter's validation flags any group in that range instead of guessing, because silently converting 1010 as ten would produce a wrong digit and break the place values.
For example, the input 0101 1010 0011 is invalid: the middle nibble is 1010, which equals 10 in plain binary and is not a decimal digit. Any decent BCD calculator will reject it for that reason. The usual cause is a number that was converted with standard binary and then fed to a BCD decoder. Some hardware assigns the unused patterns special meanings such as a sign or decimal point, but that is a system-specific convention rather than part of the basic code.
Decimal to BCD: Reversing the Conversion
Going back is just as direct. To encode the decimal number 7305, replace each digit with its nibble: 7 is 0111, 3 is 0011, 0 is 0000 and 5 is 0101, giving 0111 0011 0000 0101. A decimal to BCD converter does exactly this lookup in the other direction, so you can use one tool to check the other.
Packed BCD and Unpacked BCD
Software stores BCD in two layouts. Packed BCD puts two digits in each byte, so 7305 takes two bytes. Unpacked BCD puts one digit in each byte with the upper four bits set to 0000, so the same number takes four bytes. Packed is compact; unpacked is easier to process one digit at a time. The converter works on the packed nibble layout.
BCD vs Binary: Why Standard Binary Is Different
Standard binary packs the value into as few bits as possible, while BCD spends four bits on every digit. The comparison below shows the cost of BCD for a few numbers:
| Decimal number | Standard binary bits | BCD bits |
|---|---|---|
| 99 | 7 | 8 |
| 999 | 10 | 12 |
| 6481 | 13 | 16 |
| 65535 | 16 | 20 |
| 1000000 | 20 | 28 |
BCD wastes some memory, and its BCD arithmetic is slower than binary arithmetic. In return it keeps every decimal digit exact. Many decimal fractions, such as 0.1, cannot be stored exactly in IEEE-754 floating point, but a BCD or fixed point representation keeps them exact, so there is no rounding drift when the numbers are shown to people.
Gray Code and Excess-3 Compared With BCD Code
BCD is one of several decimal-friendly codes. Excess-3 stores each digit plus three, so 0 is 0011 and 9 is 1100; it is self-complementing, which simplified older subtraction circuits. Gray code changes only one bit between neighbouring values, which makes it useful for position encoders, but it is a counting sequence rather than a digit-by-digit decimal code. A hexadecimal reading of the same bits is different again: 0110 0100 1000 0001 read as hex is 6481 in base 16, which equals 25,729 in base ten. Always confirm the code before decoding.
BCD Addition and Arithmetic
When you add two BCD digits and the nibble sum passes 1001, the result lands in the pseudotetrade range and is not a valid digit. The fix is the correction factor 0110 (6): add it to skip the six unused patterns and carry into the next nibble. BCD subtraction applies a similar correction when a borrow occurs. These small adjustments are why BCD arithmetic needs extra circuitry compared with plain binary adders. You can check an adjusted sum with the decoder: adding 0101 and 0111 gives 1100, adding 0110 gives 0001 0010, and decoding that result returns 12.
Where BCD Is Used in Digital Systems
You find BCD wherever a human reads a number straight from hardware:
- Digital clocks and watches, which keep hours and minutes as separate decimal digits.
- Seven-segment displays, where a decoder chip turns each nibble into lit segments.
- Embedded systems and microcontroller real-time clocks that store dates in packed BCD registers.
- Financial software and meters, where exact decimal results and predictable rounding matter.
- Digital electronics classes, where students and engineers practise code conversion by hand.
Programmers and developers meet it when reading a register map or a legacy file format, and a calculator like this one saves a manual calculation every time.