ASCII Table — Complete Chart of Codes, Characters & Symbols

Complete ASCII table with decimal, hex, octal and binary codes for all 128 characters. Learn what ASCII means, its full form, and printable vs control codes.

Illustration of an ASCII table mapping characters such as A and a to their decimal codes

ASCII stands for the American Standard Code for Information Interchange. It was first published in 1963 by the American Standards Association (now ANSI) and revised in 1967 and 1986; the original character assignments are preserved in RFC 20, still the canonical reference for the 7-bit set. Despite being over 60 years old, ASCII is far from obsolete: the first 128 code points of UTF-8 — the dominant text encoding on the modern web — are identical to ASCII, which is why plain ASCII text is also valid UTF-8.

ASCII is a 7-bit character code, so each character is represented by a unique combination of 7 bits. That gives 2⁷ = 128 possible codes (0–127). Of these, 33 are non-printable control codes (0–31 and 127, DEL) originally designed to control hardware such as printers and teletypes, and the remaining 95 are printable characters — letters, digits, punctuation and the space.

Why trust this guide

Every code example here has been compiled and tested as shown, by Muhammad Saqib.

List of all ASCII Characters and Description

Decimal NumberOCT NumberHEX NumberBIN NumberSymbolDescription
0000000000000NULNull character
1001010000001SOHStart of Heading
2002020000010STXStart of Text
3003030000011ETXEnd of Text
4004040000100EOTEnd of Transmission
5005050000101ENQEnquiry
6006060000110ACKAcknowledge
7007070000111BELBell, Alert
8010080001000BSBackspace
9011090001001HTHorizontal Tab
100120A0001010LFLine Feed
110130B0001011VTVertical Tabulation
120140C0001100FFForm Feed
130150D0001101CRCarriage Return
140160E0001110SOShift Out
150170F0001111SIShift In
16020100010000DLEData Link Escape
17021110010001DC1Device Control One (XON)
18022120010010DC2Device Control Two
19023130010011DC3Device Control Three (XOFF)
20024140010100DC4Device Control Four
21025150010101NAKNegative Acknowledge
22026160010110SYNSynchronous Idle
23027170010111ETBEnd of Transmission Block
24030180011000CANCancel
25031190011001EMEnd of medium
260321A0011010SUBSubstitute
270331B0011011ESCEscape
280341C0011100FSFile Separator
290351D0011101GSGroup Separator
300361E0011110RSRecord Separator
310371F0011111USUnit Separator
32040200100000SPSpace character
33041210100001!exclamation mark
34042220100010quotation mark
35043230100011#number sign
36044240100100$dollar currency sign
37045250100101%percent sign
38046260100110&Ampersand (also used as and)
39047270100111Apostrophe (also known as single quote)
40050280101000(left parenthesis
41051290101001)right parenthesis
420522A0101010*asterisk
430532B0101011+plus sign
440542C0101100,comma
450552D0101101hyphen
460562E0101110.period
470572F0101111/slash
480603001100000number 0
490613101100011number 1
500623201100102number 2
510633301100113number 3
520643401101004number 4
530653501101015number 5
540663601101106number 6
550673701101117number 7
560703801110008number 8
570713901110019number 9
580723A0111010:colon
590733B0111011;semicolon
600743C0111100less-than
610753D0111101=equals-to
620763E0111110greater-than
630773F0111111?question mark
64100401000000@at sign
65101411000001Auppercase letter A
66102421000010Buppercase letter B
67103431000011Cuppercase letter C
68104441000100Duppercase letter D
69105451000101Euppercase letter E
70106461000110Fuppercase letter F
71107471000111Guppercase letter G
72110481001000Huppercase letter H
73111491001001Iuppercase letter I
741124A1001010Juppercase letter J
751134B1001011Kuppercase letter K
761144C1001100Luppercase letter L
771154D1001101Muppercase letter M
781164E1001110Nuppercase letter N
791174F1001111Ouppercase letter O
80120501010000Puppercase letter P
81121511010001Quppercase letter Q
82122521010010Ruppercase letter R
83123531010011Suppercase letter S
84124541010100Tuppercase letter T
85125551010101Uuppercase letter U
86126561010110Vuppercase letter V
87127571010111Wuppercase letter W
88130581011000Xuppercase letter X
89131591011001Yuppercase letter Y
901325A1011010Zuppercase letter Z
911335B1011011[left square bracket
921345C1011100\backslash
931355D1011101]right square bracket
941365E1011110^caret
951375F1011111_underscore
96140601100000`grave accent
97141611100001alowercase letter a
98142621100010blowercase letter b
99143631100011clowercase letter c
100144641100100dlowercase letter d
101145651100101elowercase letter e
102146661100110flowercase letter f
103147671100111glowercase letter g
104150681101000hlowercase letter h
105151691101001ilowercase letter i
1061526A1101010jlowercase letter j
1071536B1101011klowercase letter k
1081546C1101100llowercase letter l
1091556D1101101mlowercase letter m
1101566E1101110nlowercase letter n
1111576F1101111olowercase letter o
112160701110000plowercase letter p
113161711110001qlowercase letter q
114162721110010rlowercase letter r
115163731110011slowercase letter s
116164741110100tlowercase letter t
117165751110101ulowercase letter u
118166761110110vlowercase letter v
119167771110111wlowercase letter w
120170781111000xlowercase letter x
121171791111001ylowercase letter y
1221727A1111010zlowercase letter z
1231737B1111011{left curly brace
1241747C1111100|vertical bar (also known as pipe sign)
1251757D1111101}right curly brace
1261767E1111110~Tilde sign
1271777F1111111DELDelete
For a programmer-focused version of this chart, including escape sequences and how each code maps to C and C++ character literals, see the ASCII chart on cppreference.

Printable vs Non-Printable Characters

ASCII characters fall into two groups:

  • Control characters (0–31 and 127): non-printable codes that signal actions rather than display a glyph — for example carriage return (13), line feed (10), tab (9), escape (27) and delete (127).
  • Printable characters (32–126): the space, digits, uppercase and lowercase letters, and punctuation you can actually see on screen.

This is why the programs below substitute a blank space for any value below 32 or equal to 127 — those codes have no printable glyph.

Diagram showing ASCII ranges: control codes 0–31, printable characters 32–126, and delete at 127

Extended ASCII (128–255)

Standard ASCII only defines codes 0–127. Values 128–255 are often called “extended ASCII,” but there is no single extended-ASCII standard — what a value such as 200 displays depends entirely on the active code page. Common encodings include ISO-8859-1 (Latin-1) and Windows-1252. This ambiguity is the classic cause of mojibake — the garbled “é” characters you see when a file saved in one code page is opened as another. For anything beyond code 127, prefer a defined encoding such as UTF-8.

How to Use the ASCII Table

  • Character ↔ code conversion: look up a character’s decimal value (e.g. A = 65) when comparing or sorting characters in code.
  • Escape sequences: common control codes appear in code as escapes — \n is line feed (10), \t is tab (9), \0 is null (0).
  • Case conversion: uppercase and lowercase letters are exactly 32 apart (A=65, a=97), so flipping case is a single arithmetic operation.
  • Alt codes (Windows): hold Alt and type the decimal code on the numeric keypad to insert a character — e.g. Alt+64 = @, Alt+169 = ©.

Typing ASCII Characters with Alt Codes (Windows)

On Windows, you can type any character by holding the Alt key and entering its decimal code on the numeric keypad (Num Lock on), then releasing Alt. This is useful for symbols that aren’t printed on your keyboard.

CharacterAlt codeName
@Alt + 64At sign
#Alt + 35Number sign
&Alt + 38Ampersand
©Alt + 0169Copyright (Windows-1252)
®Alt + 0174Registered trademark
°Alt + 0176Degree
Alt + 0128Euro

Codes 0–127 use plain Alt + number. Codes prefixed with 0 (e.g. Alt + 0169) tell Windows to use the Windows-1252 code page, which is how you reach characters above 127 such as ©, ® and €.

C Program to Print ASCII Characters

This program prints the ASCII character table. The program displays each character’s Decimal, Octal, Hexadecimal, Binary, and Symbol representation. It uses a loop to iterate through all 128 ASCII values (0 to 127) and formats the output into neatly aligned columns. If you are new to the language, our C programming tutorials walk through the fundamentals from the ground up.

The program also replaces non-printable ASCII characters (values 0–31 and 127) with a blank space (' ') to avoid displaying unprintable symbols.

#include <stdio.h>
void printBinary(int num, char *binStr) {
    for (int i = 7; i >= 0; i--) {
        binStr[7 - i] = (num & (1 << i)) ? '1' : '0';
    }
    binStr[8] = '\0'; // Null-terminate the string
}
int main() {
    printf("Decimal Number\tOCT Number\tHEX Number\tBIN Number\tSymbol\n");
    for (int i = 0; i < 128; i++) {
        char bin[9]; // Array to hold the binary string (8 bits + null terminator)
        printBinary(i, bin);
        // Replace non-printable characters with a blank space
        char symbol = (i >= 32 && i <= 126) ? i : ' ';
        printf("%d\t\t%03o\t\t%02X\t\t%s\t\t%c\n", i, i, i, bin, symbol);
    }
    return 0;
}

Notice the program splits the binary conversion into its own reusable routine — see our guide to functions in C for how and why to structure code this way.

A subtle trap in C: char may be signed, so casting values above 127 to char can produce negative numbers. Use unsigned char when working with the 128–255 range.

C++ Program to Print ASCII Characters

This C++ program generates and displays the ASCII character table in a structured format. It lists each ASCII character’s Decimal, Octal, Hexadecimal, Binary, and Symbol representations. The program is designed to iterate through all 128 ASCII values (from 0 to 127) and outputs the information in aligned columns for readability.

This example uses C++20’s std::format, so compile with -std=c++20 (GCC 13+, Clang 17+, or MSVC 2022).

#include <iostream>
#include <bitset>
#include <format>
#include <string>

int main() {
    std::cout << std::format("{:<15}{:<15}{:<15}{:<20}{:<10}\n",
                              "Decimal", "OCT Number", "HEX Number", "BIN Number", "Symbol");

    for (int i = 0; i < 128; ++i) {
        std::string binary = std::bitset<8>(i).to_string();

        char symbol = (i >= 32 && i <= 126)
                      ? static_cast<char>(i)
                      : ' ';

        std::cout << std::format("{:<15}{:<15o}{:<15X}{:<20}{:<10}\n",
                                 i, i, i, binary, std::string(1, symbol));
    }

    return 0;
}

The C++ version above uses std::bitset and the C++20 std::format library; if you want a refresher on the language itself, see our complete guide to C++ programming.

Python Program to Print ASCII Characters

The program uses Python’s format function to convert each ASCII value into an 8-bit binary representation.

# Function to generate an 8-bit binary representation
def to_binary(num):
    return format(num, '08b')

# Print the header
print(f"{'Decimal Number':<15}{'OCT Number':<12}{'HEX Number':<12}{'BIN Number':<12}{'Symbol':<10}")

# Iterate through all 128 ASCII characters
for i in range(128):
    decimal = i  # Decimal representation
    octal = format(i, '03o')  # Octal representation
    hexadecimal = format(i, '02X')  # Hexadecimal representation in uppercase
    binary = to_binary(i)  # Binary representation
    symbol = chr(i) if 32 <= i <= 126 else ' '  # Display symbol or blank for non-printable characters
    
    # Print the row
    print(f"{decimal:<15}{octal:<12}{hexadecimal:<12}{binary:<12}{symbol:<10}")

C# Program to Print ASCII Characters

using System;

class AsciiTable
{
    // Method to convert an integer to 8-bit binary string
    public static string ToBinary(int num)
    {
        return Convert.ToString(num, 2).PadLeft(8, '0');
    }

    public static void Main()
    {
        // Print the header
        Console.WriteLine("{0,-15}{1,-12}{2,-12}{3,-12}{4,-10}", 
                          "Decimal Number", "OCT Number", "HEX Number", "BIN Number", "Symbol");

        // Iterate through all 128 ASCII characters
        for (int i = 0; i < 128; i++)
        {
            int decimalValue = i;  // Decimal representation
            string octal = Convert.ToString(i, 8);  // Octal representation
            string hexadecimal = Convert.ToString(i, 16).ToUpper();  // Hexadecimal representation in uppercase
            string binary = ToBinary(i);  // Binary representation
            // Display symbol or blank for non-printable characters
            string symbol = (i >= 32 && i <= 126) ? ((char)i).ToString() : " ";  

            // Print the row with proper formatting
            Console.WriteLine("{0,-15}{1,-12}{2,-12}{3,-12}{4,-10}", 
                              decimalValue, octal, hexadecimal, binary, symbol);
        }
    }
}

In practice, the single most common encoding bug I see is treating bytes 128–255 as ‘ASCII’ — a file written as Windows-1252 and read as Latin-1 will silently corrupt curly quotes, em-dashes and accented letters.

Frequently Asked Questions

References

Scroll to Top