ASCII Converter
Look up any ASCII character by its decimal code, hex value, or binary representation. Useful when working with serial communication, UART debugging, and string encoding in embedded firmware.
ASCII Character Converter
ASCII (American Standard Code for Information Interchange) maps characters to numeric values. Every character you type has a decimal code (0–127), hex value, and binary representation. Essential for UART debugging, serial communication, data encoding, and embedded firmware development.
Each character maps to decimal 0–127 (standard ASCII)
What ASCII is
ASCII assigns a number from 0 to 127 to each English letter, digit, punctuation mark and control character. Computers store and send those numbers; this converter shows the same character in decimal, hexadecimal and binary.
Printable ASCII table (selected)
| Character | Decimal | Hex | Binary |
|---|---|---|---|
| Space | 32 | 0x20 | 0010 0000 |
| 0 | 48 | 0x30 | 0011 0000 |
| 9 | 57 | 0x39 | 0011 1001 |
| A | 65 | 0x41 | 0100 0001 |
| Z | 90 | 0x5A | 0101 1010 |
| a | 97 | 0x61 | 0110 0001 |
| z | 122 | 0x7A | 0111 1010 |
| ~ | 126 | 0x7E | 0111 1110 |
Useful patterns: digits are 0x30–0x39, so '7' − '0' = 7 in C. Upper and lower case differ by exactly 32 (bit 5): 'A' is 0x41 and 'a' is 0x61.
Control characters you'll meet in serial work
| Name | Decimal | Hex | Escape | Meaning |
|---|---|---|---|---|
| NUL | 0 | 0x00 | \0 | String terminator in C |
| LF | 10 | 0x0A | \n | Line feed (Unix newline) |
| CR | 13 | 0x0D | \r | Carriage return |
| ESC | 27 | 0x1B | \e | Start of terminal escape codes |
| DEL | 127 | 0x7F | Delete |
Arduino's Serial.println() sends CR + LF (\r\n) after the text, which is why parsers often see a stray 13 before the 10.
Beyond ASCII
Characters such as °, µ, Ω and emoji are not ASCII. They are encoded as 2–4 bytes in UTF-8, so an Ω symbol sent over serial arrives as two bytes (0xCE 0xA9). Text from this converter that falls outside 0–127 is shown as its UTF-8 bytes.
Worked examples
- Parsing a number sent over serial: the text "42" arrives as bytes 0x34 0x32. Subtract '0' (0x30) from each to get the digits 4 and 2, then combine: 4 × 10 + 2 = 42. Arduino's
Serial.parseInt()does this for you. - Changing case in C: 'a' (0x61) and 'A' (0x41) differ only in bit 5 (0x20), so
c & ~0x20makes a letter uppercase andc | 0x20makes it lowercase. - Sending a command to a GPS or modem:
AT\r\nis the bytes 0x41 0x54 0x0D 0x0A. Many devices ignore a command that ends with only \n. - Checking a hex dump: a logic analyzer showing 0x48 0x65 0x6C 0x6C 0x6F on a UART line is the text "Hello".
Printable range at a glance
| Range | Characters |
|---|---|
| 0x00–0x1F | Control codes (NUL, TAB 0x09, LF 0x0A, CR 0x0D, ESC 0x1B) |
| 0x20–0x2F | Space and punctuation ! " # $ % & ' ( ) * + , - . / |
| 0x30–0x39 | Digits 0–9 |
| 0x3A–0x40 | : ; < = > ? @ |
| 0x41–0x5A | Uppercase A–Z |
| 0x5B–0x60 | [ \ ] ^ _ ` |
| 0x61–0x7A | Lowercase a–z |
| 0x7B–0x7F | { |
Common serial gotchas
Garbage characters usually mean a baud-rate mismatch, not an encoding problem. Strings that "don't match" in code often have an invisible \r on the end; trim incoming lines before comparing them.
Formula, inputs and worked examples
Formula and method
ASCII code points 0–127 map to standard 7-bit ASCII; convert decimal to hexadecimal or binary by base conversion.
Worked examples
The letter A
'A' is decimal 65, hex 0x41 and binary 01000001. Lowercase 'a' is 97 (0x61); the two differ by 32 (0x20), which is bit 5.
Digit characters
The character '0' is 48 (0x30), so '7' is 55 (0x37). In C, subtracting '0' from a digit character gives its numeric value.
Line endings
LF (newline) is 10 (0x0A) and CR (carriage return) is 13 (0x0D). Serial.println() sends CR then LF, so you see bytes 13 and 10 after the text.
Inputs
- Character or numeric code — Unit: text / integer
What the result means
- Character — Unit: text
- Decimal code — Unit: integer
- Hex code — Unit: hex
- Binary code — Unit: bits
Practical tips and common mistakes
- When a serial device sends garbage, print each received byte in hex to tell real text from a baud rate or encoding problem.
- Printable ASCII runs from 32 (space) to 126 (~). Codes below 32 are control characters.
- Bytes above 127 are not ASCII. UTF-8 text such as é or Ω uses two or more bytes per character.
- Parsers that wait for a newline should handle both LF and CR LF endings.
Assumptions and limitations
- Standard ASCII is 7-bit; bytes 128–255 depend on an encoding and are not universal ASCII.
- Serial monitors may display UTF-8 or other encodings, so a displayed character can occupy multiple bytes.
Frequently asked questions
What is the ASCII code for A?
Uppercase A is 65 in decimal, 0x41 in hex and 01000001 in binary. Lowercase a is 97 (0x61).
How do I convert text to hex?
Look up each character's ASCII code and write it in base 16: 'Hi' is 0x48 0x69. Paste the text into this converter to do it automatically.
What is the difference between \r and \n?
\r (13, carriage return) moves to the start of the line; \n (10, line feed) moves down a line. Windows and many serial devices use both (\r\n); Linux uses \n alone.
Is ASCII the same as UTF-8?
The first 128 UTF-8 codes are identical to ASCII. UTF-8 then extends it with multi-byte sequences for every other character.
Learn more
More Utilities