ASCII Code Converter

Turn short text into decimal and hex ASCII codes with counts.

Technology and NetUpdated 2026-10-162 min read
ASCII Code Converter
1 to 20 characters from space to tilde.
Decimal codes
...
Hex codes...
Length...

What it does

ASCII assigns each common keyboard character a number from 0 to 127. Programs store text as those numbers and convert back for display. When a file shows H as 72, that 72 is the ASCII code, not a calculation.

The tool above reads up to 20 printable characters and prints decimal codes, hex codes, and length. The default Hi matches the worked example, so the page opens showing 72 105 and 48 69. Type new text to update all three results.

The table covers space (32) through tilde (126), plus digits, uppercase, and lowercase letters. Digits run 48 to 57, uppercase A to Z run 65 to 90, lowercase a to z run 97 to 122. Punctuation fills the gaps between those blocks.

This converter checks input with a strict pattern. Empty text, text over 20 characters, or any character outside space to tilde returns a clear error instead of guessing. Accented letters and emoji are outside 7 bit ASCII and need Unicode tools instead.

This page shows the code layout, one full hand checked example for Hi, a short reference table, and practice checks that run through the tool.

How to use

  1. Type 1 to 20 characters using letters, digits, space, and common punctuation.
  2. Stay inside printable ASCII. Accented or emoji characters trigger an error.
  3. Read Decimal codes as base 10 values separated by spaces.
  4. Read Hex codes as base 16 values in capitals, also space separated.
  5. Match positions across the two lists: first decimal pairs with first hex.
  6. Shorten the text if you see the 20 character limit message.

Formula

Code = position of the character in the 7 bit ASCII table (0 to 127).
decimal
Base 10 code, for example H = 72.
hex
Base 16 code, for example H = 48.
count
Number of characters converted.

Hex uses digits 0 to 9 plus A to F. Decimal 72 equals hex 48 because 4x16 + 8 = 72. Case matters: H is 72 while h is 104.

Worked example

Example: Hi

Convert the two characters H and i to codes.

  1. Write the input: H followed by i, length 2 chars.
  2. Look up H: decimal 72, hex 48.
  3. Look up i: decimal 105, hex 69.
  4. Join decimals with a space: 72 105.
  5. Join hex with a space: 48 69.
  6. Check case: lowercase h would be 104, so capital H at 72 confirms the table.

Reference table

Anchor ASCII codes to memorize
CharDecimalHex
space3220
04830
A6541
Z905A
a9761
~1267E

Limits

  • Printable ASCII only. No accented letters, no emoji, no control codes.
  • 20 characters per run. Split longer strings into chunks.
  • 7 bit codes only. For beyond 127, use a Unicode converter.
  • No decoding direction here. Paste codes into an ASCII table to read back.

Common mistakes

  • Mixing cases, so h (104) is entered when H (72) was meant.
  • Reading hex 48 as decimal 48. Hex 48 is decimal 72.
  • Including a trailing space by accident, which adds code 32 to the lists.
  • Pasting smart quotes, which are outside ASCII and trigger an error.
  • Assuming character count equals byte count in UTF-8 for non ASCII text.

Try it yourself

Quick checks. Answers sit tucked under each question.

Codes for A?

Decimal 65, hex 41, length 1 char.

Codes for OK?

Decimal 79 75, hex 4F 4B, length 2 chars.

Questions

What is ASCII?

A 7 bit code that maps 128 characters, including letters, digits, punctuation, and controls, to numbers 0 to 127.

What is H in ASCII?

72 decimal, 48 hex. Lowercase h is 104 decimal, 68 hex.

Why two code lists?

Decimal suits arithmetic. Hex suits bytes and dumps. Both name the same characters.

Why does emoji fail here?

Emoji live beyond 127 in Unicode. This tool accepts only space to tilde.

Is space a character?

Yes. Space is 32 decimal, 20 hex, and counts toward length.

How do I convert back?

Split the decimal list on spaces, then look each value up in an ASCII table.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.