Text to ASCII Converter

Convert characters into their ASCII and Unicode codes.

Text to ASCII Converter tool

About the Text to ASCII Converter

Programming exercises, puzzles and data checks sometimes need the numeric code of every character. This text to ASCII converter turns text into decimal codes, with A as 65, a as 97 and a space as 32, separated by spaces, commas or new lines, and it can also show hexadecimal, octal or binary values. Characters outside basic ASCII, such as é, Urdu letters and emoji, are given as their Unicode code points instead, so nothing is lost. Codes for invisible characters such as tabs and line breaks are included too, which helps when tracking down odd spacing in data files. To reverse the process, use ASCII to Text, and for the full reference, the ASCII Table.

ASCII, the American Standard Code for Information Interchange, defines 128 characters numbered 0 to 127: control codes, digits, the English alphabet in upper and lower case, and punctuation. Unicode extends the same numbering to more than 150,000 characters while keeping the first 128 identical, so for English text ASCII codes and Unicode code points are the same. Emoji such as 😀 have large code points (128512) and are converted as one character, not as two halves.

Example: Hi! becomes 72 105 33. In hexadecimal it is 48 69 21 and in binary 1001000 1101001 100001. café gives 99 97 102 233, where 233 is é, outside ASCII.

To turn codes back into text use the ASCII to text converter. For UTF-8 bytes in hex use the text to hex converter, for bits the text to binary converter, and for escape sequences such as U+00E9 the Unicode converter.

How to use the Text to ASCII Converter

  1. Type or paste textLetters, numbers, symbols or any language.
  2. Choose the number formatDecimal by default, or hex, octal or binary.
  3. Choose the separatorSpaces, commas or one code per line.
  4. Read the codesNon-ASCII characters are counted and shown as Unicode code points.

Text to ASCII Converter features

  • Decimal ASCII codes
  • Hex, octal and binary options
  • Unicode code points beyond ASCII
  • Emoji as single code points
  • Space, comma or newline separators
  • Count of non-ASCII characters
  • Instant results

Common uses

  • Programming and debugging
  • Computer science homework
  • Checking text for hidden characters
  • Puzzles and secret messages
  • Learning character encoding

Text to ASCII codes in practice: a checksum exercise, finding non-ASCII characters, spreadsheet functions, code and domain names

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Character codes turn text into numbers that can be added, compared and checked, which is the basis of checksums, sorting and validation. This guide works through a simple checksum exercise, then shows how codes reveal characters that do not belong in ASCII-only fields, and covers spreadsheet functions, code, emoji and international domain names.

A worked example: a simple checksum

A teacher asks students to turn their names into codes and add them up. ALI becomes 65, 76 and 73, which sum to 214. Taking the last digit gives a check digit of 4. If someone later copies the name as ALT, the sum changes to 225 and the check digit to 5, revealing the error. Real check digits, such as those on barcodes and bank cards, use more careful formulas, but the principle is the same.

Finding non-ASCII characters

Fields such as usernames, file names and some identifiers must use plain ASCII. Converting text to codes and looking for any value above 127 finds characters that will cause trouble. The word café, for example, shows 233 for é, and text copied from documents may show values for curly quotes and long dashes that look harmless on screen.

Spreadsheet functions

Excel and Google Sheets provide CODE, which returns the code of the first character, and UNICODE, which returns the full Unicode code point, along with CHAR and UNICHAR to go back. On Windows versions of Excel, CODE uses the system's character set for values above 127, so UNICODE is more reliable for anything beyond basic English.

Codes in programming

Python's ord function and JavaScript's charCodeAt return character codes. For emoji and other characters outside the basic range, JavaScript's codePointAt returns the true code point, while charCodeAt returns only half of a two-part representation. Using the right function avoids subtle bugs when processing text with emoji.

Comparing without case

Because upper- and lower-case letters have different codes, comparisons that should ignore case must convert both sides first. Comparing the codes of ALI and Ali shows the difference: 76 and 108 for the second letter. Most languages provide case-insensitive comparison functions that handle this, including letters beyond English.

Keyboard codes

Older keyboard event codes for letter keys match the ASCII codes of capital letters, so the A key reports 65 whether or not Shift is held. This overlap explains why some older programs and tutorials treat key codes and character codes as interchangeable, although they are different concepts.

International domain names

Domain names were originally limited to ASCII letters, digits and hyphens. Names containing other characters, including Urdu, are converted to an ASCII form beginning with xn-- using a scheme called Punycode. Converting such a domain to codes shows why browsers need this extra step.

Codes in other bases

The converter can also show codes in hexadecimal, octal or binary. Hex is the form used in most programming documentation, while binary suits classroom exercises about how computers store letters. Choosing the base that matches where you will use the codes saves a further conversion.

Common mistakes

  • Treating text with codes above 127 as plain ASCII.
  • Using CODE instead of UNICODE for non-English text.
  • Using charCodeAt for emoji.
  • Comparing text with different cases as if equal.

Related tools

To turn codes back into text, use ASCII to Text Converter. For a full reference chart, try ASCII Table, and for domain names with non-ASCII characters, Punycode Converter.

Revealing spaces and line breaks

Converting pasted text to codes shows characters you cannot see: 32 for spaces, 9 for tabs, 13 and 10 for Windows line endings. Trailing spaces at the end of a value and stray line breaks are common reasons that a password, code or username copied from a message does not work.

Simple ciphers

Adding a fixed number to each letter's code, and wrapping round at the end of the alphabet, gives a Caesar cipher. Working with the codes makes the idea concrete: shifting A, 65, by three gives D, 68. It is a classic first exercise in programming, though such ciphers offer no real security.

Counting character types

Codes make it easy to classify characters: 65 to 90 are capitals, 97 to 122 small letters and 48 to 57 digits, with punctuation in between. Password strength checkers and form validators use exactly these ranges to count how many types of character a value contains.

Allowing Urdu in forms

Validation that accepts only codes up to 127 rejects Urdu names. Urdu letters sit in the Arabic block of Unicode, from 1536 to 1791, so validation rules can allow that range alongside English letters. Checking real Urdu names against the rules before launch prevents users being turned away.

Documenting codes for others

When reporting a bug caused by a strange character, include its code in the report, such as 160 for a non-breaking space, rather than pasting the character itself. Characters can change or vanish when copied through email and chat, while a number always arrives intact.

Privacy

Conversion runs in your browser. Your text is not uploaded or stored.

Frequently asked questions

What is the ASCII code of A?

65 for uppercase A and 97 for lowercase a. The uppercase letters run from 65 (A) to 90 (Z) and the lowercase from 97 (a) to 122 (z), exactly 32 apart.

How do I convert text to ASCII codes?

Look up the number of each character, or paste the text here. Hi! becomes 72 105 33. In JavaScript, "H".charCodeAt(0) returns 72; in Python, ord("H") does.

What are the ASCII codes for digits?

48 for 0 up to 57 for 9. That is why subtracting 48 from a digit's code gives its numeric value, a common trick in programming.

What happens with characters that are not ASCII?

They are shown as their Unicode code point, such as 233 for é or 128512 for 😀, and counted as non-ASCII, so you can see they would not fit a pure-ASCII system.

What is extended ASCII?

Various 8-bit encodings, such as Latin-1 and Windows-1252, that use codes 128 to 255 for accented letters and symbols. They differ from each other, which is why Unicode replaced them.

What is the ASCII code for a space?

32 in decimal, which is 20 in hexadecimal and 100000 in binary. Other common invisible characters are the tab (9), the line feed or new line (10) and the carriage return (13), which Windows adds before each line feed.

Can I get the codes in hex or binary?

Yes. Choose hexadecimal, octal or binary in the options. In hex, A is 41 and a is 61; in binary, A is 1000001. Switch back to decimal at any time; the text you entered stays in place.

Is ASCII the same as UTF-8?

For the 128 ASCII characters, yes: UTF-8 stores them as the same single bytes. UTF-8 then adds multi-byte sequences for every other character. That backward compatibility is why UTF-8 became the standard encoding of the web.