ASCII Codes: Complete Reference Guide for Developers

Published on · 15 min read

Table of Contents

  1. What is ASCII? A Brief History
  2. ASCII Code Categories
  3. Printable ASCII Characters Table (32–126)
  4. Control Characters Explained (0–31)
  5. Extended ASCII (128–255)
  6. ASCII vs Unicode vs UTF-8
  7. How to Type ASCII Characters
  8. ASCII in Programming
  9. ASCII Art: Creative Text Graphics
  10. Common ASCII Values Every Developer Should Know

Whether you are debugging a file encoding issue, working with low-level network protocols, or just trying to remember whether uppercase ‘A’ is 65 or 97, ASCII codes are something every developer encounters regularly. This guide covers everything you need to know about the ASCII character set, from its 1960s origins to practical usage in modern programming languages.

Interactive ASCII Table Tool

Need to look up ASCII codes quickly? Try our interactive ASCII Table tool for instant decimal, hexadecimal, octal, and binary conversions of every ASCII character.

1. What is ASCII? A Brief History

ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard that assigns numeric values to letters, digits, punctuation marks, and control characters. First published as a standard in 1963 by the American Standards Association (now ANSI), ASCII became the foundation for virtually all modern character encoding systems.

Before ASCII existed, different computer manufacturers used their own proprietary character encoding schemes. IBM used EBCDIC, while other systems had their own incompatible codes. This made it nearly impossible to exchange text data between different computer systems. ASCII solved this problem by providing a universal standard that everyone could agree on.

Key Facts About ASCII

The original ASCII standard went through several revisions. The 1963 version lacked lowercase letters (yes, really). The 1967 revision, known as ANSI X3.4-1967, added lowercase letters and finalized the character set we know today. The most recent formal revision is ANSI X3.4-1986, though the character set has remained unchanged since 1967.

2. ASCII Code Categories

The 128 ASCII characters are divided into three main categories:

RangeCategoryCountDescription
0–31Control Characters32Non-printable characters that control text processing (newlines, tabs, bell, etc.)
32–126Printable Characters95Letters, digits, punctuation, and the space character
127DEL (Delete)1Originally used to “punch out” erroneous characters on paper tape

The printable range (32–126) is what you interact with every day when typing. It breaks down further into:

The 32-Offset Trick

The difference between uppercase and lowercase letters is always exactly 32. That means you can toggle case with a single XOR operation: char ^ 32. This is because bit 5 (value 32) is the only bit that differs between ‘A’ (01000001) and ‘a’ (01100001). This was an intentional design decision by the ASCII creators.

3. Printable ASCII Characters Quick Reference (32–126)

This is the complete table of all 95 printable ASCII characters. Use our ASCII Table tool for an interactive version with search and filtering, or use the Number Base Converter to translate between decimal, hex, octal, and binary.

DecHexCharDecHexCharDecHexChar
32206440@9660`
3321!6541A9761a
3422"6642B9862b
3523#6743C9963c
3624$6844D10064d
3725%6945E10165e
3826&7046F10266f
3927'7147G10367g
4028(7248H10468h
4129)7349I10569i
422A*744AJ1066Aj
432B+754BK1076Bk
442C,764CL1086Cl
452D-774DM1096Dm
462E.784EN1106En
472F/794FO1116Fo
483008050P11270p
493118151Q11371q
503228252R11472r
513338353S11573s
523448454T11674t
533558555U11775u
543668656V11876v
553778757W11977w
563888858X12078x
573998959Y12179y
583A:905AZ1227Az
593B;915B[1237B{
603C<925C\1247C|
613D=935D]1257D}
623E>945E^1267E~
633F?955F_

Note: Character 32 is the space character, shown here as ␣ (open box symbol) for visibility.

4. Control Characters Explained (0–31)

The first 32 ASCII codes (0–31) are control characters. They were originally designed to control teletype machines and printers rather than represent printable symbols. While most are obsolete today, several remain critically important in modern computing.

Most Important Control Characters

DecHexAbbrNameEscapeModern Usage
000NULNull\0String terminator in C/C++
707BELBell\aTerminal alert/beep sound
808BSBackspace\bMove cursor back one position
909HTHorizontal Tab\tTab character in code and text
100ALFLine Feed\nNewline on Unix/Linux/macOS
110BVTVertical Tab\vRarely used; vertical spacing
120CFFForm Feed\fPage break in printing
130DCRCarriage Return\rUsed with LF for Windows newlines (\r\n)
271BESCEscape\eStart of ANSI escape sequences for terminal colors

Complete Control Characters Table (0–31 + 127)

DecHexAbbrNameDecHexAbbrName
000NULNull1610DLEData Link Escape
101SOHStart of Heading1711DC1Device Control 1 (XON)
202STXStart of Text1812DC2Device Control 2
303ETXEnd of Text1913DC3Device Control 3 (XOFF)
404EOTEnd of Transmission2014DC4Device Control 4
505ENQEnquiry2115NAKNegative Acknowledge
606ACKAcknowledge2216SYNSynchronous Idle
707BELBell2317ETBEnd of Trans. Block
808BSBackspace2418CANCancel
909HTHorizontal Tab2519EMEnd of Medium
100ALFLine Feed261ASUBSubstitute
110BVTVertical Tab271BESCEscape
120CFFForm Feed281CFSFile Separator
130DCRCarriage Return291DGSGroup Separator
140ESOShift Out301ERSRecord Separator
150FSIShift In311FUSUnit Separator
1277FDELDelete

The Newline Problem: LF vs CR vs CRLF

One of the most enduring headaches in computing comes from how different operating systems handle line endings:

This is why Git has core.autocrlf settings — to automatically convert line endings between platforms. If you have ever seen ^M characters at the end of lines in a terminal, those are carriage return characters from a Windows-formatted file.

5. Extended ASCII (128–255)

Standard ASCII only defines 128 characters using 7 bits. Since a byte has 8 bits, the remaining 128 values (128–255) were up for grabs. Various “extended ASCII” encodings filled this space differently, leading to widespread incompatibility.

Major Extended ASCII Encodings

EncodingRangeKey CharactersUsage
ISO 8859-1 (Latin-1)128–255é ñ ü ß ø £ €*Western European languages, early web standard
Windows-1252128–255“ ” ‘ ’ — – … ™Windows default; adds curly quotes and dashes where Latin-1 has control codes (128–159)
ISO 8859-15 (Latin-9)128–255€ Š š Œ œUpdated Latin-1 with Euro sign
Code Page 437128–255Box-drawing characters: ─ │ ┌ ┐Original IBM PC; DOS-era box drawing and graphics

* The Euro sign (€) is not in original Latin-1; it was added at position 164 in Latin-9, and at position 128 in Windows-1252.

Why “Extended ASCII” Is Not Really a Standard

Strictly speaking, there is no single “extended ASCII” standard. The term informally refers to any 8-bit encoding that keeps ASCII in the lower 128 values and adds more characters in 128–255. Because different systems used different mappings for those upper values, you could never be sure what character 0xE9 meant without knowing the encoding. This chaos is exactly what Unicode was created to solve.

6. ASCII vs Unicode vs UTF-8

Understanding the relationship between ASCII, Unicode, and UTF-8 is essential for modern development. Here is how they relate:

FeatureASCIIUnicodeUTF-8
What is it?Character encodingCharacter set (abstract)Encoding of Unicode
Characters128149,813+ (Unicode 16.0)All Unicode characters
Bits per char7 bits (fixed)N/A (abstract code points)1–4 bytes (variable)
ASCII compatible?Yes (is ASCII)Yes (first 128 code points)Yes (single byte for 0–127)
LanguagesEnglish onlyAll modern scripts + historicAll modern scripts + historic
Emoji supportNoYesYes (4 bytes each)
Web usage (2026)<1%N/A~98% of all websites

Unicode is not an encoding — it is a catalog that assigns a unique number (called a code point) to every character in every writing system. Code points are written as U+0041 (for ‘A’). UTF-8 is the most popular way to encode those code points into bytes for storage and transmission.

The genius of UTF-8 is that it is fully backward-compatible with ASCII. Any valid ASCII text is also valid UTF-8, because UTF-8 encodes ASCII characters 0–127 as a single byte with the same value. Characters beyond ASCII use 2, 3, or 4 bytes. This means you can safely serve ASCII files as UTF-8 without changing a single byte.

For working with encoded data in your projects, check out our Base64 Encoder/Decoder and Hash Generator tools.

7. How to Type ASCII Characters

Sometimes you need to enter a character that is not on your keyboard. Here are the methods for each major operating system:

Windows: Alt Codes

Hold Alt and type the decimal ASCII code on the numeric keypad (not the top row):

CombinationCharacterDescription
Alt + 64@At sign
Alt + 92\Backslash
Alt + 124|Pipe
Alt + 126~Tilde
Alt + 0169©Copyright (extended, Windows-1252)
Alt + 0176°Degree sign (extended)

Important: Alt + 65 and Alt + 0065 can produce different characters in the extended range (128–255) because the first uses Code Page 437 and the second uses Windows-1252.

macOS: Unicode Hex Input

  1. Enable “Unicode Hex Input” in System Settings > Keyboard > Input Sources
  2. Hold Option and type the 4-digit hex code: Option + 0041 for ‘A’

Linux: Ctrl+Shift+U

  1. Press Ctrl+Shift+U
  2. Type the hex code (e.g., 41 for ‘A’)
  3. Press Enter or Space

HTML: Character References

In HTML, you can use either decimal or hexadecimal references:

<!-- Decimal reference -->
&#65; → A
&#169; → ©

<!-- Hexadecimal reference -->
&#x41; → A
&#xA9; → ©

<!-- Named entities (selected characters) -->
&amp; → &
&lt; → <
&gt; → >
&quot; → "

8. ASCII in Programming: Escape Sequences & Char Codes

Every programming language provides ways to work with ASCII character codes. Here are practical examples in the most popular languages:

JavaScript

JavaScript
// Get ASCII code of a character
'A'.charCodeAt(0); // 65
'a'.charCodeAt(0); // 97
'0'.charCodeAt(0); // 48
' '.charCodeAt(0); // 32

// Get character from ASCII code
String.fromCharCode(65); // 'A'
String.fromCharCode(10); // '\n' (newline)

// Check if a character is uppercase
function isUpper(ch) {
  const code = ch.charCodeAt(0);
  return code >= 65 && code <= 90;
}

// Convert uppercase to lowercase (add 32)
String.fromCharCode('A'.charCodeAt(0) + 32); // 'a'

// Escape sequences
'\n' // newline (LF, ASCII 10)
'\t' // tab (HT, ASCII 9)
'\x41' // hex escape: 'A'
'\u0041' // unicode escape: 'A'

Python

Python
# Get ASCII code of a character
ord('A') # 65
ord('z') # 122
ord('\n') # 10

# Get character from ASCII code
chr(65) # 'A'
chr(48) # '0'

# Check if string is ASCII-only
'Hello'.isascii() # True
'Café'.isascii() # False

# Print full ASCII table
for i in range(32, 127):
    print(f"{i:3d} 0x{i:02X} {chr(i)}")

# Escape sequences
'\n' # newline
'\t' # tab
'\x41' # hex escape: 'A'
'\101' # octal escape: 'A'

C / C++

C
// Characters ARE their ASCII codes in C
char c = 'A'; // c == 65
int code = 'A'; // code == 65
char lower = 'A' + 32; // lower == 'a'

// Toggle case with XOR
char toggled = 'A' ^ 32; // 'a'
toggled = 'a' ^ 32; // 'A'

// Check if digit (the classic way)
if (c >= '0' && c <= '9') {
    int digit = c - '0'; // convert char to int
}

// Common escape sequences
'\n' // newline (10)
'\r' // carriage return (13)
'\t' // tab (9)
'\0' // null terminator (0)
'\x1B' // escape character (27)
'\\' // literal backslash (92)

Convert Between Number Bases

Need to convert ASCII codes between decimal, hexadecimal, octal, and binary? Use our Number Base Converter tool for instant conversions.

9. ASCII Art: Creative Text Graphics

ASCII art is the practice of creating images and designs using only the 95 printable ASCII characters. It dates back to the days of typewriters and early computer terminals when graphical displays were unavailable. Despite being decades old, ASCII art remains popular in README files, terminal UIs, email signatures, and developer culture.

Classic ASCII Art Examples

    /\_/\
   ( o.o )
    > ^ <
   /|   |\
  (_|   |_)
     Cat
            
  _____
 |     |
 | | | |
 |_____|
 |     |
 |     |
 |_____|
  Floppy
   Disk
            
   .---------.
   |.-------.|
   ||       ||
   ||       ||
   |"-------"|
   /---------\
  / _________ \
 / /         \ \
(___/_________\__)
    Computer
            

ASCII Art Techniques

ASCII artists use different characters to create shading and depth. The key concept is character density — some characters appear darker (more ink) than others:

// From lightest to darkest (commonly used gradient):
.:-=+*#%@

// Extended density scale:
.'`^",:;Il!i><~+_-?][}{1)(|\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$

Modern ASCII art generators convert images to text by mapping pixel brightness to characters from this density scale. The darker the pixel, the denser the character used.

Box-Drawing with ASCII

Before Unicode box-drawing characters existed, developers used ASCII characters to create borders and tables in terminal applications:

+----------+----------+----------+
|  Name    |  Age     |  Role    |
+----------+----------+----------+
|  Alice   |  30      |  Dev     |
|  Bob     |  25      |  Design  |
+----------+----------+----------+
            

This technique is still used today in CLI tools, logging output, and documentation. Tools like tree, htop, and git log --graph all use character-based graphics.

10. Common ASCII Values Every Developer Should Know

You do not need to memorize all 128 ASCII codes, but knowing these key values will save you time when debugging, writing parsers, or working with binary data:

NUL
Dec: 0 · Hex: 0x00
Null / String terminator
\t
Dec: 9 · Hex: 0x09
Horizontal Tab
\n
Dec: 10 · Hex: 0x0A
Line Feed (newline)
\r
Dec: 13 · Hex: 0x0D
Carriage Return
SP
Dec: 32 · Hex: 0x20
Space character
0
Dec: 48 · Hex: 0x30
Digit zero
9
Dec: 57 · Hex: 0x39
Digit nine
A
Dec: 65 · Hex: 0x41
Uppercase A
Z
Dec: 90 · Hex: 0x5A
Uppercase Z
a
Dec: 97 · Hex: 0x61
Lowercase a
z
Dec: 122 · Hex: 0x7A
Lowercase z
DEL
Dec: 127 · Hex: 0x7F
Delete character

Quick Mental Math Tricks

Common Ranges to Remember

CharactersDecimal RangeHex RangeQuick Check
Digits 0–948–570x30–0x39c >= '0' && c <= '9'
Uppercase A–Z65–900x41–0x5Ac >= 'A' && c <= 'Z'
Lowercase a–z97–1220x61–0x7Ac >= 'a' && c <= 'z'
All printable32–1260x20–0x7Ec >= ' ' && c <= '~'
Whitespace9–13, 320x09–0x0D, 0x20isspace(c)

Summary

ASCII may be over 60 years old, but it remains the bedrock of text encoding in computing. Every UTF-8 document, every JSON API response, every line of source code builds on top of those original 128 character codes. Understanding ASCII is not just trivia — it is a practical skill that helps you debug encoding issues, write more efficient parsers, and understand how text is represented at the byte level.

Key Takeaways

DevToolbox ASCII & Encoding Tools

Put your ASCII knowledge to work with our free developer tools: