Skip to content

ASCII Converter – Text to ASCII Codes and Back

Updated:

Convert text into space-separated character codes or turn decimal codes back into text. Enter your content and choose To ASCII or To Text.

Text to ASCII Code Converter

Input Fields
If enabled, the result will update automatically when you change any value.

ASCII Converter Formula

Formula
\[ a_i=\operatorname{codeUnit}(c_i),\qquad c_i=\operatorname{fromCodeUnit}(a_i\bmod 65536) \]

Where:

  • \(c_i\) — one UTF-16 code unit of the text.
  • \(a_i\) — its decimal numeric value.
  • \(i\) — the position of the code unit in the input.

To ASCII outputs the decimal value of each UTF-16 code unit, separated by spaces. To Text converts each supplied decimal integer back into a UTF-16 code unit; the modulo operation describes how valid integers outside the 0–65535 range are handled.

ASCII Converter – Calculation Example

Example: enter Hi! as Content and select To ASCII. The characters have decimal values 72, 105, and 33.

\[ \text{Hi!}\longrightarrow 72\quad 105\quad 33 \]

Result: 72 105 33. To reverse the conversion, select To Text and enter 72 105 33; the result is Hi!.

How to use the ASCII Converter

  1. Enter your input in Content. For To ASCII, type the text you want to convert. For To Text, enter decimal codes separated by spaces or other whitespace, such as 72 105 33.
  2. Choose Type: To ASCII for text-to-number conversion, or To Text for number-to-text conversion.
  3. Read the converted value under Result. You can copy it for use elsewhere.

The Content field starts empty, so enter something before converting. To Text removes whitespace around the code list and treats whitespace between codes as a separator. To represent a space in the decoded text, include code 32.

What the codes mean

ASCII assigns numbers to 128 characters and control codes, numbered 0 through 127. Common examples include A as 65, a as 97, and the space character as 32. Converting familiar letters to their numeric codes can help you inspect text, check data exchanged between programs, or understand how characters are represented.

Despite its name, this converter is not limited to ASCII values. In To ASCII mode, it uses JavaScript’s UTF-16 representation: it takes each UTF-16 code unit and prints its decimal value. Standard ASCII characters produce their usual ASCII numbers. Many other characters produce values above 127, so those values should not be described as standard ASCII codes.

In To Text mode, the converter reads each whitespace-separated entry as a decimal integer and makes a UTF-16 code unit from it. Codes from 0 through 127 correspond to standard ASCII; other valid code-unit values may produce non-ASCII characters. The result can also contain invisible characters, such as a line break, so its appearance may not reveal every code it contains.

This distinction matters most for emoji and some less common symbols. They are represented by two UTF-16 code units, so To ASCII outputs two numbers rather than one Unicode code point. If you need bytes or another encoding, this result is not a UTF-8 byte list.

Assumptions and practical tips

  • Use decimal numbers for To Text. For example, 65 66 67 produces ABC. The converter does not read hexadecimal or binary notation as a dedicated input format.
  • Separate codes with whitespace. The converter does not use commas as separators, so avoid inputs such as 65,66.
  • To include a space, tab, or line break in decoded text, use 32, 9, or 10, respectively. Spaces typed between numeric codes only separate the entries.
  • Use valid whole-number codes for predictable results. This tool does not validate each entry before conversion: malformed values can produce an unexpected or invisible character. Integers outside the UTF-16 code-unit range wrap to a value from 0 through 65535.
  • Copy the result if invisible characters make it difficult to inspect on the page. For an independent check of how much text you entered, try the Character Counter.

If you are working with representations of numbers rather than character codes, the Hex Converter and Binary Converter handle other number formats. Their outputs are not interchangeable with this converter’s space-separated decimal character codes without an additional interpretation step.

Common ASCII values

Character or control Decimal code
Space 32
Exclamation mark (!) 33
Digit 0 48
Uppercase A 65
Lowercase a 97
Line feed 10

The table shows decimal values, matching the numbers this converter produces for these ASCII characters. A line feed is a control character: it creates a line break rather than a visible letter.

Frequently Asked Questions

How can I find ASCII codes by hand?

Use an ASCII chart for a starting value, then count forward. Uppercase A is 65, so C is 67; lowercase a is 97, so c is 99. Digits start at 48 for 0, making 7 equal to 55. These shortcuts work for standard ASCII characters, not for arbitrary Unicode symbols.

What range of ASCII values should I expect for letters and digits?

Standard ASCII values run from 0 to 127. Uppercase letters occupy 65–90, lowercase letters 97–122, and digits 48–57. There is no “good” value: the number identifies a character rather than measuring its quality. Values above 127 can be valid output from this converter, but they are not standard ASCII values.

Why does an accented letter have a different UTF-8 byte value?

This converter reports UTF-16 code units, not encoded bytes. For example, é produces the decimal value 233 here, while its UTF-8 encoding consists of two bytes, 195 and 169. Both representations describe the same character in different ways. Use a UTF-8 encoder if you need bytes for a file or network message.

Why are there more numbers than visible characters?

A visible character does not always correspond to one UTF-16 code unit. An emoji may produce two numbers, while a letter followed by a combining accent can produce separate numbers even though it looks like one character. Line-ending characters can also be present without appearing as visible symbols. Count the output as code units, not necessarily as characters a reader sees.

What happens if I enter a negative number or an invalid code?

Negative integers wrap into the UTF-16 code-unit range: −1 becomes 65535, for example. The converter does not strictly validate entries; it parses the beginning of each token as a decimal integer. Thus, `65abc` can become A, while a token with no parseable number can become an invisible null character. Use plain whole numbers for reliable results.

Why do line breaks sometimes correspond to 10 and sometimes to 13 10?

Different systems represent line endings differently. A Unix-style line break is usually line feed, code 10. A Windows-style line ending commonly uses carriage return followed by line feed, codes 13 10. If you are comparing converted text from different sources, check both codes; the displayed result may look the same despite the different underlying values.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 thoughts on “ASCII Converter – Text to ASCII Codes and Back”