</>
character.codes
← Back to Learn

The ASCII Table: Every Character from 0 to 127

Published March 1, 2025

A brief history

ASCII (American Standard Code for Information Interchange) was published in 1963 as a way to standardize how computers represent text. It uses 7 bits to encode 128 characters (0–127), covering English letters, digits, punctuation, and control codes.

Despite being over 60 years old, ASCII remains the foundation of modern text encoding. UTF-8 — the dominant encoding on the web — is backwards-compatible with ASCII, meaning every valid ASCII document is also valid UTF-8.

Control characters (0–31, 127)

The first 32 ASCII codes (0–31) and code 127 are control characters. They don't represent printable symbols — instead, they control devices like printers and terminals. A few are still widely used:

  • 0 (NUL) — Null character, used as a string terminator in C
  • 9 (TAB) — Horizontal tab
  • 10 (LF) — Line feed (newline on Unix/macOS)
  • 13 (CR) — Carriage return (used with LF on Windows: CR+LF)
  • 27 (ESC) — Escape, used in terminal escape sequences (ANSI codes)
  • 127 (DEL) — Delete

Printable characters (32–126)

The 95 printable ASCII characters include:

  • 32 — Space
  • 33–47, 58–64, 91–96, 123–126 — Punctuation and symbols (! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~)
  • 48–57 — Digits 0–9
  • 65–90 — Uppercase letters A–Z
  • 97–122 — Lowercase letters a–z

Decimal, hex, and binary

Each ASCII character can be represented in multiple number bases:

CharDecHexBinary
A650x410100 0001
a970x610110 0001
0480x300011 0000
@640x400100 0000
~1260x7E0111 1110

Common uses in programming

ASCII values show up constantly in day-to-day programming:

  • Converting between uppercase and lowercase by toggling bit 5 (adding or subtracting 32)
  • Checking if a character is a digit: c >= 48 && c <= 57
  • Null-terminated strings in C/C++ (ASCII 0)
  • Escape sequences in terminals using ASCII 27 (ESC)