ThisCalculator

Everyday

ASCII to Decimal Calculator: How It Works

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

ASCII to Decimal Calculator: How It Works

This calculator converts each character in a text string into its ASCII decimal code (0–127) or extended ASCII code (0–255), depending on your chosen encoding. You enter any text, and it outputs a space-separated list of decimal numbers, one per character, plus the total character count. It is the quickest way to see the numeric value behind letters, digits, and punctuation on your keyboard.

Formula

The conversion uses the standard ASCII table, where each character is assigned a decimal number from 0 to 127. For extended ASCII (often called Latin-1 or ISO 8859-1), the range goes from 0 to 255.

For each character c in the input text, the decimal code is:

code(c) = ASCII value of c

For example, the letter ‘A’ has code 65, ‘B’ is 66, and so on. Lowercase ‘a’ is 97, ‘b’ is 98. The calculator simply reads each character, looks up its code, and outputs the list.

Worked Example

Using the default text “Hello” with ASCII (7-bit) mode:

  1. Take the first character ‘H’. Its ASCII code is 72.
  2. Next ‘e’ → 101.
  3. Next ‘l’ → 108.
  4. Next ‘l’ → 108 (again).
  5. Next ‘o’ → 111.

The output is: 72 101 108 108 111 and the character count is 5.

What ASCII Really Is

ASCII (American Standard Code for Information Interchange) was developed in the 1960s from telegraph codes. It uses 7 bits to represent 128 characters: 33 control characters (like newline, tab, backspace) and 95 printable characters (letters, digits, punctuation, and space). The 7-bit design was chosen because early teleprinters used 7 bits for data plus one parity bit.

When you type a letter on a keyboard, the computer stores it as a number. That number is what this calculator shows. For instance, the space character has code 32, the digit ‘0’ is 48, and the exclamation mark is 33.

How to Use the Calculator

  1. Type or paste your text into the “Text” field.
  2. Choose the mode: ASCII (7-bit) for standard characters, or Extended (8-bit) for characters like é, ñ, or ©.
  3. Click Calculate. The decimal codes appear in order, separated by spaces.
  4. Copy the output if you need it for programming, debugging, or learning.

The calculator works with any text, including spaces and punctuation. It treats each character separately, so a space is a valid character with code 32.

Common Mistakes and Misconceptions

  • Confusing ASCII with Unicode: ASCII is a subset of Unicode. Unicode assigns the same codes 0–127 to ASCII characters, but also includes thousands of other characters with much larger codes. This calculator only handles ASCII or extended ASCII, not full Unicode.
  • Mixing up decimal and hexadecimal: ASCII is often shown in hex (e.g., 41 for ‘A’), but this calculator outputs decimal (65). Double-check which base you need.
  • Assuming ‘A’ is 1: ‘A’ is 65, not 1. The codes start at 65 for uppercase letters, 97 for lowercase.
  • Ignoring control characters: Newline (10), carriage return (13), and tab (9) are real characters with codes. If you paste multi-line text, those codes will appear.

Why Convert ASCII to Decimal?

Programmers often need decimal codes when working with low-level data, serial communication, or file formats. For example, in C or Python, you might need to convert a character to its integer value to perform arithmetic. Web developers use ASCII codes to handle URL encoding or to validate input. Students learning computer science use it to understand how text is stored.

It’s also handy for debugging: if a file shows garbled text, converting the bytes to decimal can reveal whether the issue is an encoding mismatch or a corrupted byte.

ASCII vs. Extended ASCII vs. Unicode

Standard ASCII is 7-bit and covers English letters, digits, and common symbols. Extended ASCII uses the 8th bit to add another 128 characters, but the exact set varies by the encoding (e.g., Latin-1, Windows-1252). For example, in Latin-1, é is 233, but in Windows-1252 it’s also 233 (they share most codes). Unicode, however, assigns é the code 233 as well, but also gives a code point to every character in every language, using up to 21 bits.

This calculator’s “Extended” mode uses the Latin-1 (ISO 8859-1) mapping, which is the most common for Western European languages. If you need a different extended encoding, you should use a dedicated tool.

Frequently Asked Questions

What is the ASCII code for a space?

The space character has ASCII decimal code 32. It is a printable character, but it’s invisible, so it’s often forgotten.

How do I convert a decimal back to ASCII?

Use the reverse process: look up the character that corresponds to the decimal number. For example, 65 is ‘A’, 97 is ‘a’. Many programming languages have a function like chr() to do this.

Why does my text show numbers like 8217 for an apostrophe?

That’s because the character is not in standard ASCII. The curly apostrophe (’) is a Unicode character with code 8217. In standard ASCII, the straight apostrophe (‘) is 39. This calculator will output 39 for a straight apostrophe, but if you paste a curly one, it may not work in ASCII mode.

What is the difference between ASCII and EBCDIC?

EBCDIC is another character encoding used mainly on IBM mainframes. It assigns different numbers to characters; for example, ‘A’ is 193 in EBCDIC, not 65. ASCII is far more common in modern computing.

Does the calculator handle emojis?

No. Emojis are not part of ASCII or extended ASCII. They are Unicode characters with codes above 255. If you input an emoji, the calculator will not be able to convert it in ASCII mode; you would need a Unicode converter.

Can I use this for binary conversion?

Not directly, but you can convert the decimal output to binary manually or with another tool. For example, 65 in binary is 1000001.

Related

Formula used
in t | Text | - | Hello | 0
sel m | Mode | ASCII (7-bit)=1, Extended (8-bit)=2
out d | Decimal codes | - | join(codes) | 0
out n | Characters | - | len(t) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.