Look Up ASCII Codes for Digits: Values for 0–9 and When They Matter
ASCII codes for the digits 0–9 in decimal, hex, binary and octal, how they map to Unicode, and how to tell real digits from look-alike styled numbers.
The ten digit characters 0 through 9 occupy a single consecutive run in ASCII: decimal 48 through 57, or hexadecimal 30 through 39. If you only need a quick answer, the table below covers it. The rest of this page explains what that mapping does and does not change, how it relates to Unicode code points, and how to tell a genuine ASCII digit from a styled look-alike that may break when copied, searched or read aloud.
ASCII values for the digits 0–9
| Digit | Decimal | Hex | Binary | Octal | Unicode code point |
| 0 | 48 | 0x30 | 0011 0000 | 060 | U+0030 |
| 1 | 49 | 0x31 | 0011 0001 | 061 | U+0031 |
| 2 | 50 | 0x32 | 0011 0010 | 062 | U+0032 |
| 3 | 51 | 0x33 | 0011 0011 | 063 | U+0033 |
| 4 | 52 | 0x34 | 0011 0100 | 064 | U+0034 |
| 5 | 53 | 0x35 | 0011 0101 | 065 | U+0035 |
| 6 | 54 | 0x36 | 0011 0110 | 066 | U+0036 |
| 7 | 55 | 0x37 | 0011 0111 | 067 | U+0037 |
| 8 | 56 | 0x38 | 0011 1000 | 070 | U+0038 |
| 9 | 57 | 0x39 | 0011 1001 | 071 | U+0039 |
Common lookups answered directly: ASCII code 49 is the character 1; the ASCII value of 2 is 50; the ASCII code of 0 is 48; and the last digit, 9, is 57. In hexadecimal the pattern is easy to remember because the second hex digit equals the digit itself: 0x30 is 0, 0x35 is 5, and so on. In binary, the lower four bits hold the digit's numeric value and the upper four bits are always 0011.
Is converting digits to ASCII codes the right step for your task?
Looking up or converting to ASCII codes is useful when you are inspecting text at the character level: debugging a parser, checking why two strings that look identical do not match, writing code that turns a digit character into a number, or reading a hex dump. The main benefit is precision, because a code identifies exactly which character is present rather than what it looks like on screen.
The decisive tradeoff is that a list of codes is no longer readable as a number. The string 2026 written as codes is 50 48 50 54, which a person cannot scan and which software will not treat as the quantity two thousand and twenty-six. Plain digits are preferable whenever the text is meant for people, for search, for spreadsheets or for any form field that expects a number. Use the codes as an inspection or programming aid, not as a replacement for the digits themselves.
What the lookup actually changes
Nothing about the stored text changes when you look up a code. The character 7 is stored as the byte 0x37 whether or not you ever see that number. A lookup simply exposes the value that was already there. A conversion is different: if a tool replaces each digit with its decimal code, the stored characters change completely, and the output is a new string of different digits and separators.
It also helps to separate a digit character from a numeric value. The character 1 has code 49. The value 1, used as a character code, is a non-printing control character (Start of Heading), not the digit. Mixing these up is a frequent bug: a program that writes the number 5 into a text field as a raw byte produces an invisible control code, while one that writes the character 5 produces byte 53.
Because ASCII is the first 128 code points of Unicode, the ASCII digits have the same numbers in both systems: U+0030 through U+0039. In UTF-8 they are still stored as the single bytes 0x30 to 0x39. Any tool that reports a Unicode code point for an ordinary digit should therefore show the same value as an ASCII table.
Converting between digits and codes in code
Most languages expose the code directly. Because the digits are consecutive, subtracting the code for 0 gives the digit's numeric value, and adding it does the reverse. That shortcut only holds for the ASCII digits; it does not apply to look-alike characters described below.
# Python
ord('1') # 49
chr(50) # '2'
ord('7') - ord('0') # 7
// JavaScript
'1'.charCodeAt(0) // 49
String.fromCharCode(48) // '0'
'9'.charCodeAt(0) - 48 // 9
/* C */
char c = '0' + 4; /* '4', code 52 */
int n = '8' - '0'; /* 8 */
Digits that look like numbers but are not ASCII
This is where inspection matters most. Many Unicode characters resemble digits but have entirely different code points. Text generators that offer bold, double-struck or monospace number fonts are not changing a font; they substitute different characters. The visual style travels with the text because the characters themselves are different.
- Fullwidth digits 0–9: U+FF10 to U+FF19, common in East Asian text input.
- Mathematical bold digits 𝟎–𝟗: U+1D7CE to U+1D7D7.
- Mathematical double-struck digits 𝟘–𝟡: U+1D7D8 to U+1D7E1.
- Mathematical sans-serif and sans-serif bold digits: U+1D7E2 to U+1D7F5.
- Mathematical monospace digits 𝟶–𝟿: U+1D7F6 to U+1D7FF.
- Superscript digits: ¹ U+00B9, ² U+00B2, ³ U+00B3, ⁰ U+2070, and ⁴–⁹ at U+2074 to U+2079.
- Subscript digits ₀–₉: U+2080 to U+2089.
- Circled digits such as ① starting at U+2460.
- Digits from other scripts, such as Arabic-Indic ٠–٩ at U+0660 to U+0669 and Devanagari ०–९ at U+0966 to U+096F. These are real digits in their own writing systems, not decorative substitutes.
If a value you expected between 48 and 57 comes back as something like 120782 (hex 1D7CE), you are looking at a styled substitute, not an ASCII digit. That single check explains many cases where a number looks right but fails validation or does not match in a search.
Reversing or mirroring digit strings
Searches for reversed or mirrored numbers usually mean one of two things. Reversing the order of characters turns 123 into 321; each ASCII digit is one code point, so plain digit strings reverse cleanly. Mirroring the shape of each glyph is a visual effect, usually done with CSS transforms or images, and does not change the stored characters at all. Unicode has no standard set of mirrored digit characters, so tools claiming to produce them are substituting other symbols that merely resemble backward digits.
One case needs care: keycap emoji such as 1️⃣ are not single characters. That emoji is the digit 1 (U+0031), followed by a variation selector (U+FE0F) and a combining enclosing keycap (U+20E3). A naive reversal that works code point by code point will separate the combining keycap from its digit and produce broken output. Reversal should operate on user-perceived characters (grapheme clusters) whenever emoji or combining marks may be present.
Copying, sharing and accessibility
ASCII digits are the safest possible numeric characters: every keyboard, font, encoding in common use and search system handles them. Styled substitutes are less predictable. They depend on the destination font having the glyph, may display as empty boxes where it does not, and generally are not treated as numbers by spreadsheets, form validators or sorting routines.
Some software normalizes text before comparing it. Under Unicode NFKC normalization, fullwidth, mathematical, superscript, subscript and circled digits are mapped to the plain ASCII digits, so a system that applies NFKC may match them. Digits from other scripts, such as Arabic-Indic, are not changed by NFKC because they are distinct digits rather than styled variants. Whether a particular search engine, database or app normalizes input is specific to that product and should be checked rather than assumed.
For assistive technology, no test results were available for this article, so no claim is made about how a specific screen reader announces styled digits. Behavior is known to vary by screen reader, voice and verbosity settings, and a mathematical bold digit may be announced differently from a plain one or not as a number at all. If accessibility matters, use plain ASCII digits in the content itself and apply any bold or decorative look with styling rather than character substitution, or provide a plain-text equivalent alongside the styled version.
Bottom line
The ASCII codes 48 to 57 are the reliable reference for the digits 0 to 9, and they match Unicode U+0030 to U+0039 exactly. Use code lookups to inspect, debug and convert at the character level. Keep the digits themselves as plain ASCII in anything people will read, search, copy or enter into forms, and treat any digit whose code falls outside 48 to 57 as a different character that may not behave like a number.