CS With NehalCS With Nehal

Unicode / ASCII Simulator

See how characters are stored as numbers in ASCII, UTF-8 and UTF-16, with an interactive ASCII table.

Type some text

Every character is stored as a number (its code). The character set decides which number.

ASCII only has 128 characters (codes 0–127): English letters, digits, punctuation and control codes. é 😀 cannot be stored in ASCII, so Unicode is needed.
CharacterDenary codeUnicode code pointBinary storedBits
H72U+004810010007 (8 stored)
i105U+006911010017 (8 stored)
!33U+002101000017 (8 stored)
␣ (space)32U+002001000007 (8 stored)
c99U+006311000117 (8 stored)
a97U+006111000017 (8 stored)
f102U+006611001107 (8 stored)
é233U+00E9not in ASCII—
␣ (space)32U+002001000007 (8 stored)
😀128512U+1F600not in ASCII—
—
ASCII (7-bit)
bits
—
Extended ASCII (8-bit)
bits
112
UTF-8
bits, 1–4 bytes per character
176
UTF-16
bits, 2 or 4 bytes
320
UTF-32
bits, always 4 bytes

ASCII table (printable characters 32–126)

Click a character to see its code.

Character "A"

65
Denary
41
Hexadecimal
01000001
Lower case "a" is 97: exactly 32 more. Only bit 5 changes (01000001 → 01100001).
Codes are consecutive: if "A" is 65, then "C" is 67. Unicode keeps the same codes as ASCII for its first 128 characters.

About This Simulation

This Unicode and ASCII simulator shows how text is stored as numbers. Type any text to see each character's code in denary, hexadecimal and binary, and how many bits it needs in ASCII, UTF-8, UTF-16 and UTF-32. An interactive ASCII table shows the patterns between codes.

Features

  • Character-by-character table of codes for your own text
  • ASCII, UTF-8 and UTF-16 binary encodings
  • Total storage compared across ASCII, extended ASCII, UTF-8, UTF-16 and UTF-32
  • Warnings for characters that ASCII cannot store
  • Clickable ASCII table with upper/lower case and digit patterns

Topics covered

  • Character Sets
  • ASCII
  • Extended ASCII
  • Unicode
  • UTF-8 and UTF-16
  • Binary Representation of Text

Explanation

A character set is a list of characters with a unique number (code) for each one. ASCII uses 7 bits for 128 characters: English letters, digits, punctuation and control codes. Unicode gives a code to over a million characters, covering every writing system and emoji, and is stored using encodings such as UTF-8 and UTF-16.

How it works

  1. Each character is looked up in the character set to get its code, e.g. 'A' = 65.
  2. The code is stored in binary: 65 = 1000001 in 7-bit ASCII.
  3. Codes are in order, so 'B' = 66 and 'a' = 97. Upper and lower case differ by exactly 32.
  4. Digit characters are not their values: '0' is 48, so subtract 48 to get the number.
  5. UTF-8 uses 1 byte for ASCII characters and 2–4 bytes for others, so English text stays small while any character can be stored.

Why it matters

Character sets are on the IGCSE and AS Level syllabuses, and understanding encodings is essential when handling files, web pages and databases. Many bugs ('garbled' text) come from reading text with the wrong encoding.

Frequently Asked Questions

What is the difference between ASCII and Unicode?

ASCII has 128 characters stored in 7 bits and only covers English. Unicode has codes for over a million characters from all languages, and its first 128 codes are the same as ASCII.

Why does Unicode use more storage?

It needs more bits per character to represent far more characters. UTF-8 reduces this by using only 1 byte for common ASCII characters.

What is extended ASCII?

An 8-bit version of ASCII with 256 characters. The extra 128 codes hold symbols and accented letters, but they vary between systems.

What is the ASCII code for 'A' and 'a'?

'A' is 65 (1000001) and 'a' is 97 (1100001). They differ by 32.

Related Simulations