Skip to content
Basics

ASCII Encoding

How characters were originally mapped to 7-bit numeric values.

Time Complexity
O(1)
Space Complexity
O(1)

Interactive Visualization

H
Decimal72
Binary (7-bit)1001000
i
Decimal105
Binary (7-bit)1101001
!
Decimal33
Binary (7-bit)0100001

Technical Guide

ASCII was the first major standard for character encoding. It uses 7 bits to represent 128 characters, which was enough for English text and basic control characters. In modern 8-bit bytes, the most significant bit is usually set to zero. While limited, it remains the foundation of most modern encodings, as UTF-8 is backward-compatible with it.

Logical Phases

  • 1
    Mapping letters 'A-Z' to values 65-90.
  • 2
    Mapping digits '0-9' to values 48-57.
  • 3
    Including control codes like 10 (Newline) and 13 (Carriage Return).
  • 4
    Storing each character in exactly one byte.

Implementation

let val = 'A'.charCodeAt(0); // 65

Expert Pitfalls

Assuming ASCII can handle characters like 'é', 'λ', or Emojis.