Convert between decimal and Excess-3 code, where each digit is stored as digit + 3 in four bits – a self-complementing code from the era of decimal arithmetic hardware.
Show calculation steps
Processed privately in your browser β nothing you paste is uploaded, logged or stored.
BCDβs self-complementing cousin
Excess-3 stores each decimal digit as digit-plus-three in four bits: 0β0011, 4β0111, 9β1100. The offset looks arbitrary until you invert the bits of any code word: you get the code word of the NINESβ COMPLEMENT digit (2β7, 0β9). That property β self-complementation β made decimal subtraction cheap in relay and early transistor machines.
This converter runs both directions, applying or removing the excess per digit, with invalid patterns rejected by group.
Worked example
Encode 429: 4+3=7 β 0111 2+3=5 β 0101 9+3=12 β 1100 XS-3: 0111 0101 1100 Self-complement check: invert 0101 (digit 2) β 1010 = 7+3 β
| Digit | BCD | Excess-3 |
|---|---|---|
| 0 | 0000 | 0011 |
| 1 | 0001 | 0100 |
| 2 | 0010 | 0101 |
| 3 | 0011 | 0110 |
| 4 | 0100 | 0111 |
| 5 | 0101 | 1000 |
| 6 | 0110 | 1001 |
| 7 | 0111 | 1010 |
| 8 | 1000 | 1011 |
| 9 | 1001 | 1100 |
Why the property mattered
Ninesβ-complement subtraction turns AβB into A + comp(B) + 1 β and with XS-3, comp(B) is a bank of inverters. In 1950s hardware, inverters were nearly free while adders were expensive; the code paid rent. Superseded once binary correction logic got cheap, it remains the canonical teaching example of designing a code FOR an operation.
Valid range
Code words run 0011β1100; the six patterns outside (0000β0010, 1101β1111) decode to non-digits and are rejected with the failing subtraction shown. As with BCD, the strictness is diagnostic, not pedantic.
Privacy
Offsets are applied locally; nothing you enter is retained.
How to use the Excess-3 Code Converter
- Choose the direction – decimal to Excess-3, or Excess-3 groups back to decimal.
- Enter the digits or the 4-bit groups.
- Click "Convert".
- The steps show the +3 (or β3) applied to every digit.
Frequently asked questions
What is Excess-3 and how does it differ from BCD?
Each decimal digit is stored as digit + 3: 4 β 0111, 2 β 0101, 9 β 1100. Same one-group-per-digit structure as BCD, but the +3 offset shifts every code word – 429 becomes 0111 0101 1100 instead of BCD's 0100 0010 1001.
Why add three – what does the offset buy?
Self-complementation: inverting the bits of a digit's code gives the code of its nines' complement (XS-3 of 2 inverted is XS-3 of 7). Decimal subtraction via nines' complement then needs only inverters – elegant in relay and early transistor hardware.
Which patterns are invalid in Excess-3?
0000-0010 (would be digits β3..β1) and 1101-1111 (digits 10-12). The decoder names the offending group and shows the subtraction that exposes it.
Is Excess-3 still used anywhere?
It is essentially historical – superseded by BCD plus binary correction logic – but it remains standard coursework because self-complementing codes illustrate WHY code design matters, and legacy telephone/metering equipment used it.
Does Excess-3 preserve digit boundaries like BCD?
Yes – four bits per decimal digit, groups independent. Everything structural about BCD (group counts, display mapping) carries over; only the code words shift by three.
Can I convert Excess-3 directly to binary value?
Two steps: XS-3 β decimal here, then Decimal to Binary for the value. A direct single formula does not exist because XS-3 is a digit code, not positional notation.
Where does the conversion happen?
In your browser – offsets applied locally, nothing sent or kept.