Convert text to Unicode code points, HTML entities or JavaScript escape sequences, and decode them back. Full astral-plane and emoji support.
Convert text to Unicode code points and back. Choose HTML entities, JavaScript escapes or U+ notation. Both panes are editable, and characters outside the Basic Multilingual Plane — including every emoji — are handled as single code points rather than surrogate pairs.
Code points, encodings and surrogate pairs
A code point is not a byte
Unicode assigns every character a number called a code point, written U+ followed by hexadecimal digits. A is U+0041, 蜂 is U+8702, and the honeybee emoji is U+1F41D. That number is the character's identity. How it is stored — UTF-8, UTF-16, UTF-32 — is a separate decision, which is why this tool is distinct from the text-to-binary converter.
The surrogate pair trap
JavaScript strings are UTF-16. Code points above U+FFFF are stored as two 16-bit halves called a surrogate pair. Naive code that loops with charCodeAt sees an emoji as two meaningless values around 0xD800-0xDFFF and reports "🐝".length as 2. This converter iterates by code point, so the bee emoji produces one value, U+1F41D, not two broken halves.
The four output formats
HTML decimal entity — A. Works in any HTML document and in XML.
HTML hex entity — A. Same thing in hexadecimal, which matches how the Unicode charts are written.
JavaScript escape — \u0041. For string literals in source code. Above U+FFFF the braced form \u{1F41D} is required, and the tool emits it automatically.
Code point notation — U+0041. The form used in specifications and documentation.
Practical uses
Escaping non-ASCII text as entities lets it survive systems that mangle encodings, such as older email gateways or misconfigured databases. Inspecting code points is also the fastest way to diagnose invisible characters: a zero-width space (U+200B) or a non-breaking space (U+00A0) looks identical to a normal space on screen but breaks string comparisons. Paste suspect text here and the difference is immediately visible.
FAQs
Why does one emoji produce a single U+1F41D instead of two values?
The tool iterates by code point rather than by UTF-16 code unit. Emoji live above U+FFFF, so naive character loops split them into surrogate pairs; this one does not.
What is the difference between this and the text-to-binary tool?
This tool shows code points, the abstract identity of each character. The binary tool shows the UTF-8 bytes used to store them. One character can be one code point but three bytes.
Can I decode a mix of formats?
Yes. The decoder recognises &#..;, &#x..;, \uXXXX, \u{...} and U+.... in the same input, and any text between escapes is preserved as-is.
How do I find invisible characters in a string?
Paste it and switch to U+ notation. Zero-width spaces show as U+200B, non-breaking spaces as U+00A0, and byte-order marks as U+FEFF — all invisible on screen but obvious here.
Are HTML entities safe to put directly in a page?
Yes, numeric character references are valid in HTML and XML. Note that they only escape the characters themselves; they are not a substitute for proper HTML escaping of <, > and & in untrusted content.
Does anything leave my browser?
No. Conversion is pure string manipulation performed locally.