---
title: "ASCII and EBCDIC codes"
subject: "Digital Logic"
chapter: 1
key: "semester_3/digital_logic:ascii-ebcdic-codes"
source: https://www.bctengineer.com/q/semester_3/digital_logic/ascii-ebcdic-codes
site: BCT Engineering
---

# ASCII and EBCDIC codes

Digital Logic · Chapter 1: Introduction

- Asked in: 2078 Kartik, 1.5+1.5 marks
- Video: [Lec-16: Introduction to Binary code | ASCII, UNICODE, EBCDIC, BCD | Number System](https://www.youtube.com/watch?v=0UVSPwzGw4U) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/digital_logic/ascii-ebcdic-codes
- Whole chapter: https://www.bctengineer.com/md/semester_3/digital_logic/chapter-1

## Question

Explain ASCII and EBCDIC codes with example.

## Short answer

ASCII is a 7-bit code (128 characters) where 'A'=41H, '0'=30H. EBCDIC is an 8-bit IBM code (256 characters) where 'A'=C1H, '0'=F0H.

## Answer

Both are **alphanumeric codes**: binary codes that represent letters, digits, punctuation marks and control characters so that text can be stored and sent by digital systems.

#### ASCII
- **American Standard Code for Information Interchange.**
- A **7-bit** code, so it has $2^7 = 128$ characters (0–127); often stored in 8 bits with the MSB as 0 or as a parity bit.
- Codes 0–31 and 127 are control characters (e.g. LF = 0AH, CR = 0DH); 32–126 are printable.
- Letters and digits are in order, which makes sorting easy.
- Examples: 'A' = 100 0001 (41H), 'a' = 110 0001 (61H), '0' = 011 0000 (30H), space = 20H.
- Used in PCs, keyboards, the internet and most modern systems.

#### EBCDIC
- **Extended Binary Coded Decimal Interchange Code**, developed by IBM.
- An **8-bit** code, so up to $2^8 = 256$ characters.
- Based on BCD: the lower 4 bits of a digit are its BCD value and the upper 4 bits (zone) are 1111.
- Letters are not in one continuous block (gaps between I/J and R/S).
- Examples: 'A' = 1100 0001 (C1H), 'a' = 1000 0001 (81H), '0' = 1111 0000 (F0H), '9' = F9H.
- Used mainly in IBM mainframes.

| Character | ASCII (hex) | EBCDIC (hex) |
|---|---|---|
| A | 41 | C1 |
| a | 61 | 81 |
| 0 | 30 | F0 |

## Check yourself

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

1. How many bits does standard ASCII use, and how many characters?
   A. 8 bits, 256 characters
   B. 6 bits, 64 characters
   C. 7 bits, 128 characters
   D. 7 bits, 256 characters
   Answer: C. 2^7 = 128 characters (0-127). (Key point: ASCII width)

2. What is true of EBCDIC?
   A. It is a 7-bit code from ANSI
   B. It is a 4-bit code
   C. It is an 8-bit code developed by IBM
   D. It is used mainly in PCs
   Answer: C. EBCDIC has 8 bits, 256 codes, mostly in IBM mainframes. (Key point: EBCDIC width)

3. What is the hex code for 'A' in ASCII and EBCDIC?
   A. C1 in ASCII, 41 in EBCDIC
   B. 41 in ASCII, C1 in EBCDIC
   C. 61 in ASCII, 81 in EBCDIC
   D. 30 in ASCII, F0 in EBCDIC
   Answer: B. 'A' = 41H in ASCII and C1H in EBCDIC. (Key point: ASCII example)

4. How are digits coded in EBCDIC?
   A. Upper 4 bits 1111 and lower 4 bits the BCD value
   B. Upper 4 bits 0011 and lower 4 bits BCD
   C. Excess-3 code
   D. Gray code
   Answer: A. '0' = F0H, '9' = F9H, based on BCD. (Key point: EBCDIC digits)
