Complete ASCII Table — Character Codes Reference

All Levels 📊 128 Characters 📚 Updated: Mar 2026 💻 C, JS, Python Examples 🔍 Searchable & Filterable

What is ASCII?

ASCII (American Standard Code for Information Interchange) is a character encoding standard that maps 128 characters to numbers 0–127. It includes control characters (0–31, 127), digits (48–57), uppercase letters (65–90), lowercase letters (97–122), and punctuation/symbols. ASCII was published in 1963 and remains the foundation of all modern text encoding including UTF-8 and Unicode.

This interactive reference table lets you search, filter, and convert between characters and their decimal, hexadecimal, octal, and binary codes. Code examples in C, JavaScript, and Python are included below.

📋 Quick Reference — ASCII Ranges

0–31
Control CharactersNUL, TAB, LF, CR, ESC...
32
Space(blank space)
33–47
Symbols! " # $ % & ' ( ) * + , - . /
48–57
Digits0 1 2 3 4 5 6 7 8 9
58–64
Symbols: ; < = > ? @
65–90
Uppercase A–ZA B C D E ... X Y Z
91–96
Symbols[ \ ] ^ _ `
97–122
Lowercase a–za b c d e ... x y z
123–126
Symbols{ | } ~
127
DeleteDEL (control)

🔄 Interactive ASCII Converter

Character
A
Decimal
65
Hex
0x41
Binary
01000001
Description: Uppercase A
uppercase
Octal: 101 • C: 'A' • HTML: &#65;

📊 Complete ASCII Table (0–127)

Showing 128 of 128 characters
DecHexOctBinaryCharDescriptionCategory

🔑 Key ASCII Facts & Tricks

Upper ↔ Lower = ±32

'A' (65) + 32 = 'a' (97). The difference between any uppercase letter and its lowercase counterpart is always 32.

Digit → Number = −48

'5' (53) − 48 = 5. Subtract 48 (or '0') from a digit character's ASCII value to get the actual number.

7-Bit Encoding

Standard ASCII uses only 7 bits (0–127). Extended ASCII (128–255) varies by system and is NOT standardized.

Bit 5 = Case Flag

In binary, bit 5 (value 32) determines case. Set bit 5 → lowercase. Clear bit 5 → uppercase. A single XOR flips case!

🔤 Printable Characters Visual Grid (32–126)

Digits (0–9) Uppercase (A–Z) Lowercase (a–z) Symbols
1

C Program: Print ASCII Table

ascii_c.c
#include <stdio.h>

int main() {
    printf("Dec  Hex  Oct  Char  Description\n");
    printf("---  ---  ---  ----  -----------\n");

    for (int i = 32; i <= 126; i++) {
        printf("%-4d %-4X %-4o %-5c Printable\n", i, i, i, i);
    }

    // Character to ASCII
    char ch = 'A';
    printf("\n'%c' = ASCII %d (Hex: %X)\n", ch, ch, ch);

    // ASCII to character
    int code = 97;
    printf("ASCII %d = '%c'\n", code, code);

    return 0;
}
📤 Output:
Dec  Hex  Oct  Char  Description
---  ---  ---  ----  -----------
32   20   40   ␣     Printable
33   21   41   !     Printable
...
65   41   101  A     Printable
...
126  7E   176  ~     Printable

'A' = ASCII 65 (Hex: 41)
ASCII 97 = 'a'

🔍 Code Explanation

  • printf("%d", ch)— In C, a char IS its ASCII value. Printing with %d gives the number, %c gives the character.
  • (int) i, (char) i— Casting between int and char converts between ASCII code and character seamlessly.
  • for (32 to 126)— ASCII 32–126 are printable characters. 0–31 and 127 are control characters.
2

JavaScript: ASCII Conversions

ascii_javascript.js
// Character → ASCII code
console.log("'A' →", "A".charCodeAt(0));   // 65
console.log("'a' →", "a".charCodeAt(0));   // 97
console.log("'0' →", "0".charCodeAt(0));   // 48
console.log("'!' →", "!".charCodeAt(0));   // 33

// ASCII code → Character
console.log("65 →", String.fromCharCode(65));   // A
console.log("97 →", String.fromCharCode(97));   // a
console.log("48 →", String.fromCharCode(48));   // 0

// Print all printable ASCII characters
let table = "";
for (let i = 32; i <= 126; i++) {
    table += String.fromCharCode(i) + " ";
    if ((i - 31) % 16 === 0) table += "\n";
}
console.log("\nPrintable ASCII:\n" + table);

// Check if character is uppercase
const isUpper = (ch) => {
    const code = ch.charCodeAt(0);
    return code >= 65 && code <= 90;
};
console.log("\nIs 'H' uppercase?", isUpper("H")); // true
console.log("Is 'h' uppercase?", isUpper("h"));    // false

// Convert lowercase to uppercase using ASCII
const toUpper = (ch) =>
    String.fromCharCode(ch.charCodeAt(0) - 32);
console.log("'d' to upper:", toUpper("d")); // D
📤 Output:
'A' → 65
'a' → 97
'0' → 48
'!' → 33
65 → A
97 → a
48 → 0

Printable ASCII:
  ! " # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9 : ; < = > ?
@ A B C D E F G H I J K L M N O
...

Is 'H' uppercase? true
Is 'h' uppercase? false
'd' to upper: D

🔍 Code Explanation

  • str.charCodeAt(0)— Returns the ASCII (Unicode) value of the character at position 0.
  • String.fromCharCode(65)— Creates a character from its ASCII code — the reverse of charCodeAt.
  • code >= 65 && code <= 90— ASCII 65–90 are uppercase A–Z. This range check identifies uppercase letters.
  • charCodeAt(0) - 32— Lowercase - 32 = Uppercase (e.g., a=97, A=65, difference is 32). A classic ASCII trick!
3

Python: ASCII Operations

ascii_python.py
# Character → ASCII code
print("'A' →", ord('A'))    # 65
print("'a' →", ord('a'))    # 97
print("'0' →", ord('0'))    # 48

# ASCII code → Character
print("65 →", chr(65))      # A
print("97 →", chr(97))      # a

# Print printable ASCII table
print("\nPrintable ASCII Characters:")
for i in range(32, 127):
    print(f"{i:3d} {i:02X} {chr(i):>3}", end="  ")
    if (i - 31) % 8 == 0:
        print()

# Uppercase check
def is_upper(ch):
    return 65 <= ord(ch) <= 90

print(f"\nIs 'H' upper? {is_upper('H')}")

# Caesar cipher (rotate by 3)
def caesar_encrypt(text, shift=3):
    result = ""
    for ch in text:
        if ch.isalpha():
            base = ord('A') if ch.isupper() else ord('a')
            result += chr((ord(ch) - base + shift) % 26 + base)
        else:
            result += ch
    return result

msg = "Hello India"
encrypted = caesar_encrypt(msg)
print(f"\nOriginal:  {msg}")
print(f"Encrypted: {encrypted}")
print(f"Decrypted: {caesar_encrypt(encrypted, -3)}")
📤 Output:
'A' → 65
'a' → 97
'0' → 48
65 → A
97 → a

Printable ASCII Characters:
 32 20     33 21 !  34 22 "  35 23 #  ...

Is 'H' upper? True

Original:  Hello India
Encrypted: Khoor Lqgld
Decrypted: Hello India

🔍 Code Explanation

  • ord(ch)— Python's built-in function to get the ASCII value of a character.
  • chr(code)— Converts an ASCII code number back to its character.
  • Caesar cipher— A classic encryption technique that shifts each letter by a fixed number of positions using ASCII math.

⚔️ ASCII vs Unicode vs UTF-8

FeatureASCIIUnicodeUTF-8
Characters128149,000+149,000+
Bits Used7 bitsUp to 21 bits8–32 bits (variable)
LanguagesEnglish onlyAll languages + emojiAll languages + emoji
Hindi Support❌ No✅ Yes (Devanagari)✅ Yes
Backward Compatible⚠️ Depends on encoding✅ With ASCII
File SizeSmallestVariesEfficient for English
Year Introduced196319911993

📝 Key Takeaways:

  • 'A' = 65, 'a' = 97, '0' = 48 — memorize these three and you can derive the rest.
  • Uppercase + 32 = Lowercase. This is because bit 5 (value 32) is the case flag in ASCII.
  • In C, char is just a small integer — it stores the ASCII value directly.
  • UTF-8 is backward-compatible: the first 128 UTF-8 characters are identical to ASCII.
  • ASCII 10 (LF) = \n, ASCII 9 (TAB) = \t, ASCII 0 (NUL) = \0 — essential for C strings.

✍️ Practice Problems

1

Print Full ASCII Table

Write a C program to print all printable ASCII characters (32–126) with their decimal and hex values.

2

Case Converter

Convert a string from uppercase to lowercase using ASCII arithmetic (±32), without built-in functions.

3

Caesar Cipher

Implement a Caesar cipher that shifts each letter by N positions using ASCII math and modulo.

4

Digit Extractor

Given a string like "abc123def", extract only digit characters using ASCII range checks (48–57).

5

Vowel Counter

Count vowels in a string using their ASCII values. Handle both uppercase and lowercase.

6

Binary to ASCII Art

Convert a binary string (01000001) to its ASCII character and display it.

❓ Frequently Asked Questions

ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns a unique number (0–127) to each character including letters, digits, punctuation, and control characters. It was developed in the 1960s and is the foundation of all modern text encoding systems like UTF-8 and Unicode.
The standard ASCII table has 128 characters (0–127). Of these, 33 are non-printable control characters (0–31 and 127), and 95 are printable characters (32–126) including space, digits, uppercase letters, lowercase letters, and punctuation/symbols.
ASCII uses 7 bits and supports only 128 characters (English only). Unicode supports over 149,000 characters from all world languages, emojis, and symbols. UTF-8 (the most common Unicode encoding) is backward-compatible with ASCII — the first 128 UTF-8 characters are identical to ASCII.
Uppercase 'A' has ASCII value 65 (hex 41). Lowercase 'a' has ASCII value 97 (hex 61). The difference is always 32 — this is why adding/subtracting 32 converts between upper and lowercase in C and many other languages.
Control characters (0–31 and 127) are non-printable characters used for controlling devices and formatting. Common ones: 0 (NUL) — null terminator in C strings, 9 (TAB) — horizontal tab, 10 (LF/\n) — new line, 13 (CR/\r) — carriage return, 27 (ESC) — escape key, 127 (DEL) — delete.
In C, characters ARE their ASCII values. Simply assign a char to an int: int code = 'A'; gives 65. To print: printf("%d", 'A'); outputs 65. To convert back: char ch = 65; gives 'A'. This works because C stores characters as their ASCII number internally.
This was intentionally designed! In binary, 32 = 00100000 (bit 5). Uppercase A = 01000001 (65), lowercase a = 01100001 (97). The only difference is bit 5. Setting bit 5 makes it lowercase, clearing it makes it uppercase. This allows fast case conversion with a single bit operation.
Yes! While Unicode/UTF-8 has largely replaced ASCII for international text, ASCII remains critical: (1) UTF-8 is backward-compatible with ASCII, (2) All programming languages use ASCII for keywords/syntax, (3) Network protocols (HTTP, SMTP) use ASCII, (4) Most English text files are valid ASCII. Understanding ASCII is essential for every programmer.

Try ASCII in Our Online C Compiler!

Print ASCII tables, convert characters, and experiment with ASCII math — all in your browser.

Open C Compiler →

Found this reference helpful?

Your support helps us build more free programming tools and references for students across India. 🇮🇳

Buy me a Coffee ☕