What is ASCII?
ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns numeric values to 128 characters including English letters, digits, punctuation marks, and control characters. It forms the foundation of modern text encoding systems.
Quick Facts
| Full Name | American Standard Code for Information Interchange |
|---|---|
| Created | 1963 (first published by ASA) |
| Specification | Official Specification |
How It Works
ASCII was developed in the 1960s and became the dominant character encoding for computers and the internet. It uses 7 bits to represent each character, allowing for 128 unique values (0-127). The first 32 codes (0-31) are control characters for device communication, while codes 32-126 represent printable characters. Code 127 is the delete character. Extended ASCII uses 8 bits to include additional characters (128-255), though these extensions vary by system. ASCII's simplicity made it foundational, but its limitation to English characters led to the development of Unicode.
Key Characteristics
- 7-bit encoding with 128 possible characters
- Codes 0-31 are non-printable control characters
- Codes 32-126 are printable characters
- Uppercase letters: 65-90 (A-Z)
- Lowercase letters: 97-122 (a-z)
- Digits: 48-57 (0-9)
Common Use Cases
- Text file encoding and storage
- Network protocol communication
- Programming language source code
- Data transmission between systems
- Character validation and filtering
Example
Loading code...Frequently Asked Questions
What is the difference between ASCII and Unicode?
ASCII uses 7 bits to represent 128 characters, primarily English letters, digits, and basic symbols. Unicode is a much larger standard that can represent over 143,000 characters from virtually all writing systems worldwide. Unicode includes ASCII as its first 128 code points, ensuring backward compatibility.
Why does ASCII use 7 bits instead of 8?
ASCII was designed in the 1960s when memory was expensive and 7 bits were sufficient to represent all necessary characters for English text and control codes. The 8th bit was often used for parity checking in data transmission. Extended ASCII later utilized the 8th bit to add 128 more characters.
What are ASCII control characters and what are they used for?
ASCII control characters (codes 0-31 and 127) are non-printable characters used to control devices and format text. Examples include NULL (0), Line Feed (10), Carriage Return (13), Tab (9), and Escape (27). They were originally designed for teletype machines and printers but are still used in modern computing.
How do I convert between ASCII values and characters in programming?
In most programming languages, you can convert using built-in functions. In JavaScript: String.fromCharCode(65) returns 'A' and 'A'.charCodeAt(0) returns 65. In Python: chr(65) returns 'A' and ord('A') returns 65. These conversions are fundamental for text processing tasks.
Why is ASCII still relevant today when we have Unicode?
ASCII remains relevant because it's the foundation of Unicode, efficient for English text, widely supported across all systems, and essential for understanding character encoding. Many protocols, file formats, and legacy systems still rely on ASCII. It's also used in programming for operations like case conversion (uppercase letters differ from lowercase by 32).