How Are Characters Represented as Decimal Numbers in Computers?
Computers represent characters as numbers, and decimal character codes are the human-friendly way to read those values. A letter, digit, symbol, or control character gets a numeric code point, so text can be stored, moved, and decoded without guessing. If you want to inspect a string fast, try our free text to decimal tool.
What decimal character codes actually mean
A character code is a mapping rule: this number stands for this character. In plain ASCII, that mapping is tiny and predictable. For example, A is 65, a is 97, and 0 is 48.
This is why a string can be turned into a row of numbers and still be reversible. The computer is not “thinking in letters”; it is storing bytes and code points. The display layer turns those numbers back into readable text when needed.
People often use the phrase “decimal character codes” to mean “show the character values in base 10.” That is a display choice, not a storage format. Under the hood, bytes are still bytes; decimal is just the form you see on screen.
ASCII, Unicode, and why the numbers get bigger
ASCII was the original small map for English text and basic control characters. It covers 128 values, which is enough for uppercase and lowercase Latin letters, digits, punctuation, and a few formatting characters like newline and tab. That is why old examples usually look simple and tidy.
Unicode expanded the idea far beyond ASCII. It includes accented letters, symbols, non-Latin scripts, emoji, and thousands of other characters. So instead of every useful character fitting into 0–127, you now see code points such as 8364 for € or 128522 for 😊.
If you want the historical background on why this works at all, our guide on why every character has a number in ASCII walks through the original model. The short version: codes make text deterministic. No code, no agreement, no reliable text handling.
Decimal is not the same as encoding
It helps to separate encoding from display format. An encoding decides how text becomes bytes. Decimal output is just one way to print those values after the fact.
For example, the string Hi might be shown as decimal character codes like 72 105. That does not mean the text was stored “as decimal.” It means the underlying codes for H and i were rendered in base 10 instead of hex or binary.
This matters when you compare tools. One tool may show UTF-8 bytes, another may show Unicode code points, and another may show ASCII values. Those can look similar for basic English text and completely different for emoji or accented characters.
Bytes, code points, and why tools sometimes disagree
Here is the trap: “character code” can mean different things depending on context. In ASCII, a character often matches one byte. In Unicode, a character may be represented by one or more bytes in UTF-8, while its code point is a single number.
That distinction is where debugging gets interesting. If you paste é into a tool, one tool may show the Unicode code point 233, while another may show UTF-8 bytes 195 169. Both are valid, but they answer different questions.
If you are handling text in code, make sure you know whether you need bytes, code points, or encoded output. A log file, an API payload, and a terminal all may interpret the same string differently. That is how “simple text” turns into a bug hunt.
Where decimal character codes are useful
Decimal codes are not just a curiosity for retro-computing fans. They are practical when you need to inspect invisible characters, compare text safely, or understand what an encoder is doing. Developers run into them when debugging copy-pasted content, broken imports, or weird whitespace.
- Check whether a string contains a newline, tab, or non-breaking space.
- Verify the exact contents of pasted text in forms or config files.
- Compare characters across systems that expose values in decimal.
- Teach the relationship between text and numeric encodings without hand-waving.
Decimal output is also handy when you are moving between languages or tools. A data pipeline might emit code points as numbers because they are easy to store in logs or JSON. Humans can read them more easily than raw binary.
A Worked Example
Suppose you want to convert the string Cat! into decimal character codes. The process is boring in the best possible way: take each character, look up its numeric value, and write the numbers in order.
Input text: Cat!C = 67
a = 97
t = 116
! = 33Decimal character codes: 67 97 116 33Now take a non-ASCII example, like €A. In Unicode, € is 8364 and A is 65, so the decimal representation becomes:
Input text: €A€ = 8364
A = 65Decimal character codes: 8364 65That looks simple, but the storage layer matters. If your program is reading UTF-8 bytes, € is not a single byte value. It is a multibyte sequence, which is exactly why you should know which layer a tool is showing you.
How to think about the conversion in code
Most programming languages can turn text into numbers with a few built-in calls. In JavaScript, for example, you can inspect a character with charCodeAt() or codePointAt(). The first is older and works on UTF-16 code units; the second is the safer choice for full Unicode characters.
const text = 'Cat!';
for (const ch of text) {
console.log(ch, ch.codePointAt(0));
}That will print each character with its decimal code point. If you loop through a string this way, you get a much better picture of Unicode than by treating the text as raw bytes. For ASCII-only input, the numbers will line up with the familiar values people expect.
In Python, the equivalent is usually ord(ch) for a single character. In Go, Rust, and other languages, the exact API differs, but the idea does not. A character is mapped to a number, and that number can be shown in decimal, hex, or binary.
Frequently Asked Questions
What is the decimal code for a character?
It is the base-10 number associated with that character in an encoding or Unicode code point table. For ASCII, the code for A is 65, while space is 32. For Unicode characters, the decimal value can be much larger.
Is ASCII the same as decimal character codes?
No. ASCII is an encoding standard, while decimal is just a way to write the numeric values. ASCII characters can be displayed as decimal numbers, but the encoding and the number format are not the same thing.
Why do some tools show different numbers for the same character?
Because one tool may show Unicode code points and another may show encoded bytes, usually UTF-8. For plain English text, those often look similar. For characters like € or emoji, they can diverge a lot.
How do I convert text to decimal character codes in my browser?
Paste the text into a browser-based converter and read the decimal output. For a quick check, use the text to decimal tool and compare the result with the characters you typed. It is faster than writing a script when you just need a one-off lookup.
The Bottom Line
Decimal character codes are just numbers standing in for text. The useful part is not the number format itself, but the fact that the mapping is stable and reversible. Once you know whether you are looking at ASCII, Unicode code points, or raw bytes, the confusion drops off fast.
For debugging, teaching, or quick inspection, the simplest path is usually the best one. Paste the text, read the values, and compare them against what you expected. If you want to check a string without writing code, give the text to decimal tool a spin.