CHC
Character Code
Convert characters to code points and back.
Ad · Large Rectangle (336×280)
How to use Character Code
Convert characters to code points and back.
- Type a character or a numeric code into the Your text field.
- Set Direction to toCode for its ASCII or Unicode code point, or toChar to turn a code back into a character.
- Press Run and read the result.
When you actually reach for this
- You are debugging why two strings that look identical fail an equality check and suspect hidden or composed characters.
- You need the numeric code point to build a lookup table or validate input in a script.
Where this tool stops being accurate
- JavaScript charCodeAt reports a UTF-16 code unit, not a Unicode code point — characters outside the BMP (emoji, some symbols) return surrogate pairs, not one number.
- It cannot tell you whether a character is "letter" or "digit" by itself; you need a Unicode property test for that.
Frequently asked questions
What does Character Code do?
Convert characters to code points and back.
Why does charCodeAt give me two numbers for one emoji?
The emoji is stored as a surrogate pair in UTF-16, so you get two code units. Use codePointAt and Array.from(str) to count real characters instead of code units.
Is the value I get the same as the Unicode code point?
Only for characters in the Basic Multilingual Plane (code points up to U+FFFF). Beyond that, charCodeAt returns surrogate halves, so switch to codePointAt for accurate values.