Home Programming ASCII table explained: From basics to technical insights

ASCII table explained: From basics to technical insights

Explore the ASCII table's intricacies in this article. Learn about its history, structure, and crucial role in character encoding, offering insights into how ASCII facilitates digital communication and data representation in computing, essential for programmers and digital professionals.

by Divya Kiran Kumar
ascii guide

Hello, FOSSLinux readers! Today I’m excited to delve into the fascinating world of the ASCII table. It’s not just a character encoding standard; it represents the bridge between human language and computer language. In this post, I’ll guide you through the intricacies of the ASCII table, from its historical significance to its practical applications in modern computing.

We’ll explore how ASCII is used in programming, its creative expression in ASCII art, and even its playful side in ASCII-based games. My goal is to shed light on this fundamental aspect of computing in a way that’s both informative and engaging, revealing the hidden charm of these 128 characters that are so crucial in our digital lives. So, let’s go on this ride through the ASCII table and uncover the mysteries of these seemingly simple yet profoundly impactful characters.

What is the ASCII table?

ASCII, short for American Standard Code for Information Interchange, is like the Rosetta Stone of computer text encoding. It’s a character encoding standard used by computers and other devices to represent text and characters. Each character (like ‘A’, ‘7’, or ‘?’) is assigned a unique number, and this is where the ASCII table comes into play. It’s a lookup table that ties these numbers to their corresponding characters.

Why ASCII matters

To me, the beauty of ASCII lies in its simplicity and universality. It’s the foundation of text processing in computers and the Internet. Every time you type a key or read text on a screen, ASCII is working behind the scenes.

Exploring the ASCII table

The standard ASCII table consists of 128 characters, including 33 non-printable control characters and 95 printable characters. The printable characters include:

  • Letters (both uppercase and lowercase)
  • Digits (0-9)
  • Punctuation marks
  • A few miscellaneous symbols

A peek into the table

Here’s a small snippet of the ASCII table to give you an idea:

ASCII Code Character
65 A
66 B
67 C
97 a
98 b
99 c
48 0
49 1
50 2

How to view the ASCII table

You can easily view the ASCII table using a command on your Linux terminal or command prompt. Here’s how:

  1. Open Terminal.
  2. Type man ascii and press Enter.
  3. You’ll see the ASCII table displayed.
ASCII(7) Linux Programmer's Manual ASCII(7)
ascii - ASCII character set encoded in octal, decimal, and hexadecimal
The ASCII character set consists of 128 characters (0 to 127 decimal,
0 to 77 octal, and 0 to 7F hexadecimal). These characters include the
same upper and lower case alphabetic characters, numerals, punctuation
marks, and special symbols used in the English language.

The following table contains the 128 ASCII characters.

C program '\X' escapes are noted.

Oct Dec Hex Char Oct Dec Hex Char
000 0 00 NUL '\0' (null character) 100 64 40 @
001 1 01 SOH (start of heading) 101 65 41 A
002 2 02 STX (start of text) 102 66 42 B
003 3 03 ETX (end of text) 103 67 43 C
004 4 04 EOT (end of transmission) 104 68 44 D
005 5 05 ENQ (enquiry) 105 69 45 E
006 6 06 ACK (acknowledge) 106 70 46 F
007 7 07 BEL '\a' (bell) 107 71 47 G
010 8 08 BS '\b' (backspace) 110 72 48 H
011 9 09 HT '\t' (horizontal tab) 111 73 49 I
012 10 0A LF '\n' (new line) 112 74 4A J
013 11 0B VT '\v' (vertical tab) 113 75 4B K
014 12 0C FF '\f' (form feed) 114 76 4C L
015 13 0D CR '\r' (carriage ret) 115 77 4D M
016 14 0E SO (shift out) 116 78 4E N
017 15 0F SI (shift in) 117 79 4F O
020 16 10 DLE (data link escape) 120 80 50 P
021 17 11 DC1 (device control 1) 121 81 51 Q
022 18 12 DC2 (device control 2) 122 82 52 R
023 19 13 DC3 (device control 3) 123 83 53 S
024 20 14 DC4 (device control 4) 124 84 54 T
025 21 15 NAK (negative ack.) 125 85 55 U
026 22 16 SYN (synchronous idle) 126 86 56 V
027 23 17 ETB (end of trans. blk) 127 87 57 W
030 24 18 CAN (cancel) 130 88 58 X
031 25 19 EM (end of medium) 131 89 59 Y
032 26 1A SUB (substitute) 132 90 5A Z
033 27 1B ESC (escape) 133 91 5B [
034 28 1C FS (file separator) 134 92 5C \ '\\'
035 29 1D GS (group separator) 135 93 5D ]
036 30 1E RS (record separator) 136 94 5E ^
037 31 1F US (unit separator) 137 95 5F _
040 32 20 SPACE 140 96 60 `
041 33 21 ! 141 97 61 a
042 34 22 " 142 98 62 b
043 35 23 # 143 99 63 c
044 36 24 $ 144 100 64 d
045 37 25 % 145 101 65 e
046 38 26 & 146 102 66 f
047 39 27 ' 147 103 67 g
050 40 28 ( 150 104 68 h
051 41 29 ) 151 105 69 i
052 42 2A * 152 106 6A j
053 43 2B + 153 107 6B k
054 44 2C , 154 108 6C l
055 45 2D - 155 109 6D m
056 46 2E . 156 110 6E n
057 47 2F / 157 111 6F o
060 48 30 0 160 112 70 p
061 49 31 1 161 113 71 q
062 50 32 2 162 114 72 r
063 51 33 3 163 115 73 s
064 52 34 4 164 116 74 t
065 53 35 5 165 117 75 u
066 54 36 6 166 118 76 v
067 55 37 7 167 119 77 w
070 56 38 8 170 120 78 x
071 57 39 9 171 121 79 y
072 58 3A : 172 122 7A z
073 59 3B ; 173 123 7B {
074 60 3C < 174 124 7C |
075 61 3D = 175 125 7D }
076 62 3E > 176 126 7E ~

These commands are simple, but they open a window into understanding how your computer encodes characters.

The syntax of ASCII

ASCII’s syntax is straightforward: it’s a numerical representation of characters. For instance, the capital letter ‘A’ is represented as 65. In programming, you might often convert characters to their ASCII values and vice versa.

A practical example

In Python, you can easily convert a character to its ASCII value and back:

# Convert character to ASCII
char = 'A'
ascii_value = ord(char)
print(f"The ASCII value of {char} is {ascii_value}")

# Convert ASCII to character
ascii = 65
char = chr(ascii)
print(f"The character for ASCII {ascii} is {char}")

This code snippet demonstrates the conversion process, which is quite handy in various programming scenarios.

Unlocking the secrets of the ASCII table

As we delve deeper into the fascinating world of the ASCII table, I’m here to enrich our journey with more insights and intriguing facts. So, let’s further unravel the mysteries of this cornerstone of digital communication.

The historical context of ASCII

Birth of a standard

ASCII wasn’t born in a vacuum. Its development in the early 1960s was a response to the need for a common industry standard for computers to communicate. Before ASCII, computers from different manufacturers often couldn’t talk to each other, which was, frankly, a digital Tower of Babel.

ASCII’s impact on computing

The adoption of ASCII was a game-changer. It allowed for interoperability between different computer systems, paving the way for the connected digital world we know today.

ASCII and programming languages

ASCII in C and Python

Most modern programming languages like C, Python, and Java, inherently support ASCII. For example, in C, characters are stored as ASCII values by default. In Python, functions like ord() and chr() are built-in to work with ASCII.

Code snippet in C
#include <stdio.h>

int main() {
    char c = 'A';
    printf("The ASCII value of %c is %d", c, c);
    return 0;

This snippet shows how effortlessly C handles ASCII values.

ASCII art: A creative twist

The art of text

ASCII art, where pictures are created using ASCII characters, is a delightful application of the ASCII table. It’s amazing how combinations of simple characters can create intricate images. ASCII art harkens back to a simpler time in computing, yet it remains popular in modern internet culture.

Creating your own ASCII art

There are online tools and software that convert images into ASCII art. For those who enjoy a bit of nostalgia or creativity, this is a fun way to engage with ASCII.

ASCII art is the craft of creating images using the characters in the ASCII table. It’s a unique blend of creativity and digital constraints that has been popular since the early days of computing.

Creating simple ASCII art

Here’s a simple example of ASCII art – a smiley face:


This is just the tip of the iceberg! ASCII art can range from these simple emoticons to incredibly detailed pictures. For example, here is our logo image converted to ASCII art in Pop!_OS terminal.

converting image to ascii art in linux terminal

Converting image to ASCII art in Linux Terminal

ASCII in messages: Adding flair to text

ASCII characters can be used to add flair to messages or social media posts. For instance, using simple ASCII symbols to create borders or dividers can make a plain text post more eye-catching.

Example of a text divider

------====< ASCII MAGIC >====------

ASCII games: Retro fun

Did you know that there are games entirely made out of ASCII characters? These are called ASCII games, and they offer a nostalgic trip back to the early days of video gaming.

Popular ASCII Games

  • Rogue: This is a dungeon crawling video game that originally used ASCII characters to represent rooms, monsters, and treasures.
  • Dwarf Fortress: A more modern example, known for its complex gameplay and ASCII graphics.

Play with ASCII in your terminal

Both Linux and Windows command lines can be used to have some ASCII fun. For example, you can display ASCII art, play games, or even run small programs that utilize ASCII characters.

Example: ASCII Star Wars in Terminal

If you’re using Linux or macOS, you can watch an ASCII version of Star Wars in your terminal! Just type the following command:

telnet towel.blinkenlights.nl

This connects you to a server that streams the entire Star Wars Episode IV movie in ASCII art!

star wars episode iv on linux terminal

Star Wars Episode IV on Linux Terminal

Extended ASCII and character encoding

Beyond the standard 128 characters

While the standard ASCII table has 128 characters, the extended ASCII set includes additional 128 characters, making it a total of 256. This extension includes characters from various European languages, mathematical symbols, and graphical symbols.

ASCII and Unicode

Unicode is like ASCII’s big sibling, designed to include characters and symbols from almost all the world’s writing systems. While ASCII fits in 7 bits, Unicode requires more, but ASCII’s 128 characters are a subset of Unicode, ensuring backward compatibility.

ASCII in networking

ASCII’s role in internet protocols

ASCII isn’t just about text display; it’s crucial in internet protocols like HTTP, SMTP (email), and FTP. For instance, the headers in HTTP requests and responses are encoded in ASCII. This aspect underscores ASCII’s ongoing relevance in networking.

The future of ASCII

While Unicode has largely taken over in terms of supporting a vast array of characters and symbols from different languages, ASCII still remains a critical part of computing history and present-day operations. Its legacy continues in the way we interact with computers and the internet.

Frequently Asked Questions about ASCII

As we wrap up our exploration of the ASCII table, it’s time to address some common questions that often arise about ASCII. This FAQ section aims to clarify any lingering curiosities or confusions. So, let’s dive into the most frequently asked questions!

What is the full form of ASCII?

ASCII stands for American Standard Code for Information Interchange. It’s a character encoding standard used for representing text in computers and other electronic devices.

Why was ASCII created?

ASCII was created to standardize the way computers represent letters, numbers, and other characters. Before ASCII, different computer systems had their own ways of representing these characters, which made it difficult for systems to communicate with each other.

Are ASCII and Unicode the same?

No, ASCII and Unicode are not the same, though they are related. ASCII is a subset of Unicode. While ASCII can represent 128 characters, Unicode was developed to include characters and symbols from almost all of the world’s writing systems, supporting over 140,000 characters.

How many characters are there in the ASCII table?

The standard ASCII table consists of 128 characters, which include control characters (non-printable) and printable characters, such as letters, digits, punctuation marks, and a few miscellaneous symbols.

Can ASCII represent characters from all languages?

No, standard ASCII cannot represent characters from most languages other than English. This limitation led to the development of extended ASCII and eventually Unicode, which can represent characters from virtually all languages.

Is ASCII still used today?

Yes, ASCII is still widely used today, especially in programming and data communication. It forms the basis of text files and is used in internet protocols like HTTP and SMTP. However, for languages other than English, Unicode is generally preferred.

How do you convert characters to ASCII in programming?

In most programming languages, there are built-in functions to convert characters to their ASCII values. For example, in Python, the ord() function returns the ASCII value of a character, and chr() returns the character associated with an ASCII value.

What are ASCII control characters?

ASCII control characters are non-printable characters in the ASCII table used to control certain actions. For example, the character with ASCII value 7 is a bell character that originally triggered an audible bell or beep in terminals.

Can ASCII be used for encryption?

While ASCII itself is not an encryption method, it can be used in conjunction with encryption algorithms. Converting text to ASCII values is a common step in many encryption and hashing processes.

Is ASCII relevant in modern computing?

Absolutely! Despite the advent of Unicode, ASCII is still relevant and widely used in modern computing. It remains integral in programming, data formats, and internet protocols, underscoring its enduring importance in the digital world.

Handy ASCII quick reference table

For our readers who love to have a quick reference at their fingertips, here’s a handy two-column ASCII table. This table focuses on the printable characters, which are often the most used and recognized. It’s a great tool for anyone starting in programming, working with text data, or just curious about ASCII codes.

Character ASCII Code (Decimal)
Space 32
! 33
# 35
$ 36
% 37
& 38
( 40
) 41
* 42
+ 43
, 44
. 46
/ 47
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
: 58
; 59
< 60
= 61
> 62
? 63
@ 64
A 65
B 66
C 67
D 68
E 69
F 70
G 71
H 72
I 73
J 74
K 75
L 76
M 77
N 78
O 79
P 80
Q 81
R 82
S 83
T 84
U 85
V 86
W 87
X 88
Y 89
Z 90
[ 91
\ 92
] 93
^ 94
_ 95
` 96
a 97
b 98
c 99
d 100
e 101
f 102
g 103
h 104
i 105
j 106
k 107
l 108
m 109
n 110
o 111
p 112
q 113
r 114
s 115
t 116
u 117
v 118
w 119
x 120
y 121
z 122
{ 123
| 124
} 125
~ 126

This table covers the range of ASCII codes from 32 (space) to 126 (tilde ~), which includes most characters you’ll encounter in everyday computing tasks. Keep this table handy for quick lookups, and you’ll find working with ASCII a breeze!

Wrapping up

As we conclude our exploration of the ASCII table, it’s clear that this simple yet powerful character encoding standard is more than just a technical relic; it’s a foundational element of modern computing. From its historical significance in unifying computer communications to its practical applications in programming, ASCII remains a vital tool.

Our journey through ASCII art, games, and practical uses in everyday computing underscores its versatility and enduring relevance. Whether you’re a programmer, a digital artist, or just a tech enthusiast, the world of ASCII offers a fascinating blend of simplicity, creativity, and utility.

You may also like

Leave a Comment



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us


©2016-2023 FOSS LINUX



“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.