---
title: "Excess-3 code with examples"
subject: "Digital Logic"
chapter: 1
key: "semester_3/digital_logic:excess3-code-explain"
source: https://www.bctengineer.com/q/semester_3/digital_logic/excess3-code-explain
site: BCT Engineering
---

# Excess-3 code with examples

Digital Logic · Chapter 1: Introduction

- Asked in: 2078 Kartik, 3 marks; 2078 Bhadra, 1.5 marks; 2075 Chaitra, 2.5 marks; 2068 Chaitra, 6 marks (asked 4 times)
- Video: [Excess-3 Code (XS-3 Code)](https://www.youtube.com/watch?v=LHw8TVk9iOY) — Neso Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/digital_logic/excess3-code-explain
- Whole chapter: https://www.bctengineer.com/md/semester_3/digital_logic/chapter-1

## Question

Explain Excess-3 code with suitable examples.

## Short answer

Excess-3 code represents each decimal digit as 4-bit binary of (digit+3). Example: decimal 39 becomes 3→0110, 9→1100, so (0110 1100) in XS-3. It is self-complementing and aids decimal arithmetic.

## Answer

**Excess-3 (XS-3) code** is a non-weighted BCD code in which each decimal digit is coded as the 4-bit binary of **(digit + 3)**. It was used in early computers and calculators because it makes decimal arithmetic easier.

#### Excess-3 table

| Decimal | BCD (8421) | 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 |

Codes 0000, 0001, 0010, 1101, 1110, 1111 are invalid (unused).

#### How to convert
Add 3 to each decimal digit separately, then write each result in 4-bit binary.

**Example 1:** $(39)_{10}$
- 3 + 3 = 6 → 0110
- 9 + 3 = 12 → 1100
- $(39)_{10} = (0110\ 1100)_{XS-3}$

**Example 2:** $(258)_{10}$
- 2 → 0101, 5 → 1000, 8 → 1011
- $(258)_{10} = (0101\ 1000\ 1011)_{XS-3}$

#### Properties
1. **Unweighted code**: bit positions have no fixed weights.
2. **Self-complementing**: the 9's complement of a digit is obtained by simply inverting all bits. For example, 4 = 0111; inverting gives 1000 = 5 in XS-3, and $9 - 4 = 5$. This made subtraction simple in old machines.
3. **No all-zero code**: every valid code has at least one 1, which helps detect a dead line.
4. **Easy addition**: when two XS-3 digits are added, a carry occurs exactly when the decimal sum exceeds 9. Correction: if there is a carry, add 0011 to the digit; if no carry, subtract 0011.

**Addition example:** $4 + 5$
- $0111 + 1000 = 1111$, no carry
- subtract 0011: $1111 - 0011 = 1100$ = 9 in XS-3

Excess-3 is therefore a convenient BCD code for decimal arithmetic, though it needs more bits than pure binary.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is a decimal digit coded in Excess-3?
   A. As the 4-bit binary of (digit + 3)
   B. As the 4-bit binary of the digit itself
   C. As the 4-bit binary of (digit - 3)
   D. As the 4-bit binary of (digit x 3)
   Answer: A. Excess-3 adds 3 to each digit and writes the result in 4-bit binary. (Key point: XS-3 definition)

2. What is (39) in Excess-3?
   A. 0011 1001
   B. 0110 1100
   C. 0110 1001
   D. 0101 1100
   Answer: B. 3+3=6 gives 0110 and 9+3=12 gives 1100. (Key point: Conversion example)

3. Why is Excess-3 called self-complementing?
   A. Inverting all bits gives the 10's complement
   B. It has no invalid codes
   C. Inverting all bits of a digit's code gives the code of its 9's complement
   D. Adding 3 always gives the complement
   Answer: C. For example 4 = 0111, inverted 1000 = 5 = 9 - 4. (Key point: Self-complementing)

4. After adding two XS-3 digits, what correction is applied?
   A. Add 0110 if the sum exceeds 9
   B. Always add 0011
   C. Subtract 0011 if there is a carry
   D. Add 0011 if there is a carry, subtract 0011 if no carry
   Answer: D. A carry means decimal sum above 9, so add 3; otherwise remove the extra 3 by subtracting 0011. (Key point: Addition correction)

## Related in Digital Logic

- [ASCII code and binary-to-Excess-3 converter](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aascii-binary-excess3-converter) — Digital Logic, chapter 1, asked 2×
- [Excess-3 code and binary-to-Excess-3 converter](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aexcess3-binary-converter) — Digital Logic, chapter 1, asked 2×
- [39 to Gray/Excess-3 and 2's complement addition](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Aconvert-39-gray-excess3-addition) — Digital Logic, chapter 1
- [Digital/analog signals, Gray and Excess-3 codes](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Adigital-analog-gray-excess3) — Digital Logic, chapter 1
- [(1110)gray→BCD and (1430)₁₀→Excess-3](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Agray-to-bcd-decimal-to-excess3) — Digital Logic, chapter 1
