How to use
- Choose Encode to turn text into decimal numbers, or Decode to turn numbers back into text.
- Type or paste your input, or open a file. The result updates as you type.
- Pick a separator for the numbers: space, comma or new line.
- Copy the numbers or download them as a file.
Decimal byte values and ASCII codes
Every character in a computer is stored as one or more bytes, and a byte is simply a number from 0 to 255. This tool writes each of those numbers in ordinary decimal notation. For English text the numbers are the familiar ASCII codes: capital letters run from 65 to 90, lowercase letters from 97 to 122, the digits 0 to 9 from 48 to 57, and a space is 32. Control characters sit below 32, for example 10 for a line feed and 13 for a carriage return.
The result is the same list you get from ord() in Python or from reading a Uint8Array in JavaScript, and it is a handy way to spot invisible characters, line endings or a byte order mark in a string.
One number per byte, not one big number
The conversion works byte by byte: a two-letter word becomes two numbers, not a single integer. Values above 127 never appear in ASCII text. In UTF-8 they come in runs of two to four bytes that together form one character, which is why an accented letter or a Chinese character produces several numbers. For one value per character in Western European text, choose ISO-8859-1, where each byte value equals the character's Unicode code point, or Windows-1252.
To convert a single number between bases instead, for example 255 to hexadecimal, use the number base converter. To see the same bytes in other notations, try hex or binary.
Decimal byte values in code
# Python
list('Hi'.encode()) # [72, 105]
bytes([72, 105]).decode() # 'Hi'
// JavaScript
[...new TextEncoder().encode('Hi')] // [72, 105]
new TextDecoder().decode(new Uint8Array([72, 105])) // 'Hi'
Specification
| Alphabet | 0-9 |
|---|---|
| Output size | 1 to 3 digits per byte, plus separators |
| Padding | None |
| Standard | Decimal byte values |
| Case sensitive | No |
Examples
| Input (UTF-8) | Output |
|---|---|
Hello, World! | 72 101 108 108 111 44 32 87 111 114 108 100 33 |
Base64.is | 66 97 115 101 54 52 46 105 115 |
你好 | 228 189 160 229 165 189 |
Frequently asked questions
What is the decimal ASCII code of A?
Capital A is 65 and lowercase a is 97, both in ASCII and in UTF-8. Each following letter adds one, so Z is 90 and z is 122.
Can I decode decimal numbers without separators?
No. A run of digits such as 72105 could be split in more than one way, so the decoder needs the numbers separated by spaces, commas, semicolons or line breaks. Leading zeros are allowed.
Why do numbers above 255 give an error?
A byte holds values from 0 to 255. Larger numbers, such as the Unicode code point 8364 of the euro sign, are not byte values. Type the character itself and encode it to see its bytes, for example in UTF-8.
Why does one character turn into several numbers?
UTF-8 stores characters outside ASCII as two, three or four bytes, and each byte becomes its own number. Choose a single-byte character set such as Windows-1252 if you need one number per Western European character.