keecode logokeecode
ASCII
ascii table
ascii codes
character encoding
decimal to hex
ascii chart
ascii reference

Complete ASCII Table with Decimal, Hex & Binary Values

Complete ASCII table with decimal, hexadecimal, binary values and characters. Includes printable ASCII characters, control codes, and extended ASCII reference.

โ€ขUpdated January 15, 2025

ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns numeric codes to letters, numbers, and symbols. This complete reference includes all 128 ASCII characters with decimal, hexadecimal, binary, and HTML entity values.

Table of Contents

  1. What is ASCII?
  2. ASCII Control Characters (0-31)
  3. Printable ASCII Characters (32-126)
  4. Common ASCII Character Uses
  5. ASCII vs Unicode
  6. How to Use ASCII Codes
  7. Summary

What is ASCII?

ASCII is a 7-bit character encoding standard developed in the 1960s. Each character is represented by a number from 0 to 127, which computers use to store and transmit text. ASCII includes:

  • Control characters (0-31): Non-printable codes used for text formatting and device control
  • Printable characters (32-126): Letters, numbers, punctuation, and symbols you can see and type
  • DEL character (127): Delete control character

ASCII Control Characters (0-31)

Control characters are non-printable codes used to control devices like printers and terminals. While many are obsolete, some remain essential.

Most Important Control Characters

DecHexBinaryCharNameCommon Use
00x0000000000NULNullString terminator in C/C++
90x0900001001HTTabHorizontal tab, indentation
100x0A00001010LFLine FeedNew line (Unix/Linux/Mac)
130x0D00001101CRCarriage ReturnNew line in Windows (with LF)
270x1B00011011ESCEscapeTerminal escape sequences
320x2000100000SPSpaceWord separator

View Tab character (9) | View Line Feed (10) | View Carriage Return (13)

Complete Control Characters Table

DecHexCharNameDecHexCharName
00x00NULNull160x10DLEData Link Escape
10x01SOHStart of Heading170x11DC1Device Control 1
20x02STXStart of Text180x12DC2Device Control 2
30x03ETXEnd of Text190x13DC3Device Control 3
40x04EOTEnd of Transmission200x14DC4Device Control 4
50x05ENQEnquiry210x15NAKNegative Acknowledge
60x06ACKAcknowledge220x16SYNSynchronous Idle
70x07BELBell230x17ETBEnd of Trans. Block
80x08BSBackspace240x18CANCancel
90x09HTHorizontal Tab250x19EMEnd of Medium
100x0ALFLine Feed260x1ASUBSubstitute
110x0BVTVertical Tab270x1BESCEscape
120x0CFFForm Feed280x1CFSFile Separator
130x0DCRCarriage Return290x1DGSGroup Separator
140x0ESOShift Out300x1ERSRecord Separator
150x0FSIShift In310x1FUSUnit Separator

Printable ASCII Characters (32-126)

These are the characters you can see and type on a standard keyboard.

Space and Symbols (32-47)

DecHexCharDescriptionDecHexCharDescription
320x20 Space400x28(Left parenthesis
330x21!Exclamation410x29)Right parenthesis
340x22"Double quote420x2A*Asterisk
350x23#Hash/Number430x2B+Plus
360x24$Dollar440x2C,Comma
370x25%Percent450x2D-Hyphen/Minus
380x26&Ampersand460x2E.Period/Dot
390x27'Single quote470x2F/Forward slash

Numbers (48-57)

DecHexCharDecHexCharDecHexChar
480x300510x333540x366
490x311520x344550x377
500x322530x355560x388

View all number codes

More Symbols (58-64)

DecHexCharDescriptionDecHexCharDescription
580x3A:Colon620x3E>Greater than
590x3B;Semicolon630x3F?Question mark
600x3C<Less than640x40@At sign
610x3D=Equals

Uppercase Letters (65-90)

DecHexCharDecHexCharDecHexCharDecHexChar
650x41A720x48H790x4FO860x56V
660x42B730x49I800x50P870x57W
670x43C740x4AJ810x51Q880x58X
680x44D750x4BK820x52R890x59Y
690x45E760x4CL830x53S900x5AZ
700x46F770x4DM840x54T
710x47G780x4EN850x55U

View letter A (65) | View all uppercase letters

Brackets and More (91-96)

DecHexCharDescriptionDecHexCharDescription
910x5B[Left bracket940x5E^Caret
920x5C\Backslash950x5F_Underscore
930x5D]Right bracket960x60`Grave accent

Lowercase Letters (97-122)

DecHexCharDecHexCharDecHexCharDecHexChar
970x61a1040x68h1110x6Fo1180x76v
980x62b1050x69i1120x70p1190x77w
990x63c1060x6Aj1130x71q1200x78x
1000x64d1070x6Bk1140x72r1210x79y
1010x65e1080x6Cl1150x73s1220x7Az
1020x66f1090x6Dm1160x74t
1030x67g1100x6En1170x75u

View letter a (97) | View all lowercase letters

Final Characters (123-127)

DecHexCharDescription
1230x7B{Left brace
1240x7C|Vertical bar
1250x7D}Right brace
1260x7E~Tilde
1270x7FDELDelete

Common ASCII Character Uses

Programming Characters

Essential Symbols:

  • Space (32) - Most common character, separates tokens
  • Tab (9) - Code indentation
  • Parentheses ( ) (40, 41) - Function calls, grouping
  • Brackets [ ] (91, 93) - Arrays, indexing
  • Braces { } (123, 125) - Code blocks, objects
  • Semicolon ; (59) - Statement terminator
  • Equals = (61) - Assignment operator
  • Quotes " ' (34, 39) - Strings

Mathematical Operators:

  • Plus + (43) - Addition
  • Minus - (45) - Subtraction
  • Asterisk * (42) - Multiplication
  • Slash / (47) - Division
  • Percent % (37) - Modulo

Comparison:

  • Less than < (60)
  • Greater than > (62)
  • Equals = (61)

ASCII vs Unicode

featureasciiunicode
Total Characters128143,000+
Encoding7-bit (fixed)Variable (UTF-8, UTF-16, UTF-32)
Language SupportEnglish onlyAll world languages
EmojisNoYes
File SizeSmaller (1 byte/char)Larger (1-4 bytes/char)
CompatibilityUniversal supportFirst 128 match ASCII
Development Year19631991

When to Use ASCII

โœ… Use ASCII for:

  • Working with legacy systems
  • File formats that require ASCII
  • Network protocols
  • Performance-critical applications
  • Programming language keywords

When to Use Unicode

โœ… Use Unicode for:

  • International websites
  • Supporting multiple languages
  • Emojis and special symbols
  • Modern web development (UTF-8 is standard)

How to Use ASCII Codes

JavaScript

// Convert character to ASCII code
'A'.charCodeAt(0);  // Returns: 65
'z'.charCodeAt(0);  // Returns: 122

// Convert ASCII code to character
String.fromCharCode(65);   // Returns: 'A'
String.fromCharCode(122);  // Returns: 'z'

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

// Check if character is a digit
function isDigit(char) {
  const code = char.charCodeAt(0);
  return code >= 48 && code <= 57;
}

// Convert case (using ASCII math)
function toUpperCase(char) {
  const code = char.charCodeAt(0);
  if (code >= 97 && code <= 122) {
    return String.fromCharCode(code - 32);
  }
  return char;
}

function toLowerCase(char) {
  const code = char.charCodeAt(0);
  if (code >= 65 && code <= 90) {
    return String.fromCharCode(code + 32);
  }
  return char;
}

Python

# Convert character to ASCII code
ord('A')   # Returns: 65
ord('z')   # Returns: 122

# Convert ASCII code to character
chr(65)    # Returns: 'A'
chr(122)   # Returns: 'z'

# Check if character is alphanumeric
def is_alphanumeric(char):
    code = ord(char)
    return (65 <= code <= 90) or (97 <= code <= 122) or (48 <= code <= 57)

# Case conversion
def to_upper(char):
    code = ord(char)
    if 97 <= code <= 122:
        return chr(code - 32)
    return char

C/C++

#include <stdio.h>

// Characters are already ASCII values
char c = 'A';
printf("%d", c);  // Prints: 65

// Convert ASCII to character
char c = 65;
printf("%c", c);  // Prints: A

// Check if uppercase
int isUpperCase(char c) {
    return c >= 65 && c <= 90;
}

// Convert to lowercase
char toLowerCase(char c) {
    if (c >= 65 && c <= 90) {
        return c + 32;
    }
    return c;
}

Java

// Convert character to ASCII
char c = 'A';
int ascii = (int) c;  // Returns: 65

// Convert ASCII to character
char c = (char) 65;   // Returns: 'A'

// Using Character class
Character.isDigit('5');      // true
Character.isLetter('A');     // true
Character.isUpperCase('A');  // true
Character.toLowerCase('A');  // 'a'

PHP

<?php
// Convert character to ASCII
ord('A');   // Returns: 65

// Convert ASCII to character
chr(65);    // Returns: 'A'

// Check character type
ctype_alpha('A');   // true
ctype_digit('5');   // true
ctype_upper('A');   // true
?>

Programming Patterns with ASCII

Caesar Cipher Example

function caesarCipher(text, shift) {
  let result = '';
  
  for (let i = 0; i < text.length; i++) {
    let code = text.charCodeAt(i);
    
    // Uppercase letters (65-90)
    if (code >= 65 && code <= 90) {
      code = ((code - 65 + shift) % 26) + 65;
    }
    // Lowercase letters (97-122)
    else if (code >= 97 && code <= 122) {
      code = ((code - 97 + shift) % 26) + 97;
    }
    
    result += String.fromCharCode(code);
  }
  
  return result;
}

caesarCipher('Hello World', 3);  
// Returns: 'Khoor Zruog'

caesarCipher('Khoor Zruog', -3);  
// Returns: 'Hello World'

Validating ASCII-Only Strings

// Check if string contains only ASCII characters
function isASCII(str) {
  for (let i = 0; i < str.length; i++) {
    if (str.charCodeAt(i) > 127) {
      return false;
    }
  }
  return true;
}

isASCII('Hello');  // true
isASCII('Hello ๐Ÿ‘‹');  // false

// Remove non-ASCII characters
function removeNonASCII(str) {
  return str.replace(/[^\x00-\x7F]/g, '');
}

removeNonASCII('Hello ๐Ÿ‘‹ World');  
// Returns: 'Hello  World'

Quick Reference: Most Used ASCII Codes

CharacterDecimalHexCommon Use
Space320x20Word separator
0-948-570x30-0x39Digits
A-Z65-900x41-0x5AUppercase letters
a-z97-1220x61-0x7ALowercase letters
!330x21Negation, emphasis
"340x22String delimiter
#350x23Hash, comments
$360x24Variables, currency
%370x25Modulo operator
&380x26AND operator
( )40-410x28-0x29Function calls
*420x2AMultiplication
+430x2BAddition
,440x2CSeparator
-450x2DSubtraction
.460x2EDecimal, property access
/470x2FDivision, paths
:580x3AKey-value separator
;590x3BStatement terminator
<600x3CLess than
=610x3DAssignment
>620x3EGreater than
?630x3FTernary operator
@640x40Decorators, email
[ ]91,930x5B,0x5DArrays
\920x5CEscape character
{ }123,1250x7B,0x7DCode blocks
|1240x7COR operator, pipes

Summary

ASCII remains fundamental to computing despite being 60+ years old. The first 128 characters of modern Unicode are identical to ASCII, ensuring backward compatibility. Whether you're debugging character encoding issues, working with legacy systems, or understanding how computers represent text, this ASCII table is your complete reference.

Key Takeaways:

โœ… ASCII uses 7 bits to encode 128 characters (0-127)
โœ… Control characters (0-31) handle formatting and device control
โœ… Printable characters (32-126) include all letters, numbers, and symbols
โœ… Uppercase and lowercase letters are exactly 32 apart
โœ… Modern UTF-8 includes ASCII as its first 128 characters
โœ… ASCII is still essential for programming, URLs, and protocols