ASCII & Unicode Value
calculator.
See the number behind every letter and symbol, or turn numbers back into text.
- Characters
- 6
- UTF-8 bytes
- 6
- Outside ASCII
- 0
All 6 characters are ASCII, so UTF-8 stores each in one byte, 6 bytes in all.
How UTF-8 stores a character
Pick a characterH is U+0048, code 72, in the printable ascii. UTF-8 stores it as 1 byte: 48. The shaded bits are fixed markers that say how long the sequence is; the rest carry the code point.
Every character
| Character | Decimal | Hex | Binary | Octal | UTF-8 | HTML |
|---|---|---|---|---|---|---|
| H | 72Binary 01001000 | 48Octal 110 | 01001000 | 110 | 48HTML H | H |
| e | 101Binary 01100101 | 65Octal 145 | 01100101 | 145 | 65HTML e | e |
| l | 108Binary 01101100 | 6COctal 154 | 01101100 | 154 | 6CHTML l | l |
| l | 108Binary 01101100 | 6COctal 154 | 01101100 | 154 | 6CHTML l | l |
| o | 111Binary 01101111 | 6FOctal 157 | 01101111 | 157 | 6FHTML o | o |
| ! | 33Binary 00100001 | 21Octal 41 | 00100001 | 41 | 21HTML ! | ! |
Where your characters fall
| Range | Codes | Bytes | Yours |
|---|---|---|---|
| Control codesCodes 0 to 31 and 127 | 0 to 31 and 127 | 1 | 0 |
| Printable ASCIICodes 32 to 126 | 32 to 126 | 1 | 6 |
| Latin-1 rangeCodes 128 to 255 | 128 to 255 | 2 | 0 |
| Rest of plane 0Codes 256 to FFFF (hex) | 256 to FFFF (hex) | 2 or 3 | 0 |
| Planes 1 to 16Codes 10000 to 10FFFF | 10000 to 10FFFF | 4 | 0 |
Byte counts from RFC 3629. Control codes are the 33 that RFC 20 names; Unicode keeps the first 256 codes equal to Latin-1.
ASCII codes 0 to 127
| Decimal | Hex | Character | Kind |
|---|---|---|---|
| 0 | 00 | NUL | Control |
| 1 | 01 | SOH | Control |
| 2 | 02 | STX | Control |
| 3 | 03 | ETX | Control |
| 4 | 04 | EOT | Control |
| 5 | 05 | ENQ | Control |
| 6 | 06 | ACK | Control |
| 7 | 07 | BEL | Control |
How it's worked out
Every character a computer stores is a number. ASCII is a 7-bit code, so it has 128 numbers, 0 to 127. It gives 72 to H, 105 to i and 32 to the space. The first 32 codes and code 127 are control codes, such as LF (line feed, 10), that steer a printer or a screen. They print no symbol, so the tool shows each one by its short name.
Unicode goes much further. It has 1,114,112 code points, written as U+ and a hex number, and its first 128 are the same as ASCII. So the code of a plain English letter is the same in both. A code point is the character's number; how that number is saved in a file is a separate step.
That step is usually UTF-8. It saves codes up to 127 as one byte, so ASCII text is unchanged. Larger codes take two, three or four bytes. Each byte starts with fixed marker bits that tell a reader how long the group is, and the rest of the bits carry the code point.
| Code points (hex) | Bytes | First byte starts |
|---|---|---|
| 0 to 7F | 1 | 0 |
| 80 to 7FF | 2 | 110 |
| 800 to FFFF | 3 | 1110 |
| 10000 to 10FFFF | 4 | 11110 |
Every byte after the first starts with 10. A code is the same number in any base: the tool shows it in decimal, hex, binary or octal, and the bits do not change.
Worked examples
Priya lists the codes in her name for a class exercise
Priya's class has to print the code of each character in "Hi Sam". The tool gives 72 105 32 83 97 109. The space counts as a character too: it is code 32, so her answer has 6 numbers, not 5.
Her teacher also asks for binary. The H is 01001000 and the i is 01101001. Each is 8 digits here, because a byte has 8 bits, but ASCII only ever uses the lower 7.
Marco finds out why his menu shows the wrong letters
Marco types "Café" into his shop's website, and the page shows two odd symbols where the last letter should be. The tool shows 4 characters but 5 bytes in UTF-8. The é is U+00E9, code 233, outside ASCII, so it takes the bytes C3 A9.
The first byte is 110 then 00011, and the second is 10 then 101001. A program that reads each byte as one Latin-1 character shows 2 characters instead of one, starting with Ã. The fix is to tell that program the page is UTF-8, not to change the text.
A puzzle hunt clue written in numbers
A clue card reads 68 105 103 105 116. Read as decimal codes, they spell "Digit". Every number is between 65 and 122, the span from A to z, which is a good sign that a list of numbers is ASCII text.
If the next card used hex, the same word would be 44 69 67 69 74. Set the base to hex, or write each code with 0x, and the tool reads them the same way.
Reading your result
Characters and bytes can differ. For plain English text the two counts match. Once a character is outside ASCII they split: the euro sign is U+20AC, which takes 3 bytes. A database column sized in bytes can then hold fewer characters than you expect.
UTF-16 code units are a third count. JavaScript, Java and C# store text in 16-bit units. A code point above U+FFFF, such as the grinning face emoji at U+1F600, needs two of them, so one emoji has a length of 2 in those languages. The tool shows this count next to the character count.
The range tells you how a character behaves. Control codes print nothing. Codes 128 to 255 are where old 8-bit code pages disagree, which is why one byte can show as a different symbol on another system. Unicode keeps one meaning for every code, and its first 256 match Latin-1.
HTML references have limits. You can write any character in a web page as an ampersand, a hash, the code and a semicolon. The HTML standard does not allow this for most control codes or for carriage return, so the tool says when a reference would be refused.
Common mistakes
- Reading the number 10 as one character. The text "10" is two characters, 49 and 48. The digit 0 is code 48, not 0; code 0 is the NUL control code, NUL.
- Calling 128 to 255 ASCII. ASCII stops at 127. "Extended ASCII" means one of several code pages, so say which one, or use Unicode code points as this tool does.
- Mixing up the code point and the bytes. U+00E9 is the number of é. C3 A9 is how UTF-8 saves it. Tools that take bytes and tools that take code points want different input.
- Missing the line endings. A pasted line break is LF, code 10. Text from Windows files often ends lines with CR then LF, 13 then 10, which you will see as two codes.