ModernCalcs

Unicode Converter

Break text down into code points, UTF-8 bytes, HTML entities and JS escapes — or decode escapes back into text.

CharCode PointUTF-8 BytesHTML EntityJS Escape
CU+004343C\u0043
aU+006161a\u0061
fU+006666f\u0066
éU+00E9C3 A9é\u00E9
U+002020 \u0020
😀U+1F600F0 9F 98 80😀\u{1F600}
U+002020 \u0020
ä½ U+4F60E4 BD A0你\u4F60
好U+597DE5 A5 BD好\u597D
All as JS Escapes
\u0043\u0061\u0066\u00E9\u0020\u{1F600}\u0020\u4F60\u597D
All as HTML Entities
Café 😀 你好
Café 😀 你好

Unicode Converter: Code Points, UTF-8, HTML Entities, and JS Escapes

Every character you type — from plain ASCII letters to emoji and non-Latin scripts — has a Unicode code point, a set of UTF-8 bytes, and multiple text-safe escaped representations. This tool breaks any string down into all of these forms at once, and decodes escaped text back into readable characters.

Formula
Character -> Code Point (U+XXXX) -> UTF-8 Bytes / HTML Entity / JS Escape

Example: 'é' -> U+00E9 -> UTF-8: C3 A9 -> HTML: é -> JS: \\u00e9

Why Emoji Need Special Handling

Characters above U+FFFF — which includes most emoji — are represented in JavaScript strings as a 'surrogate pair': two 16-bit code units that only make sense together. A naive character-by-character loop using string indexing or split('') breaks these pairs apart, producing garbage. This tool uses Array.from(), which is surrogate-pair aware, so multi-byte characters are handled correctly.

Code Point vs. UTF-8 Encoding

The code point is an abstract identity (a number). UTF-8 is one specific way to turn that number into bytes for storage or network transmission, using a variable-length scheme: 1 byte for ASCII (0-127), 2 bytes for most Latin-extended and Greek/Cyrillic characters, 3 bytes for most CJK characters, and 4 bytes for emoji and rarer scripts.

Choosing Between Escape Formats

HTML entities (é or é) are for embedding characters safely in HTML markup. JavaScript escapes (\u00e9 or \u{1f600}) are for representing characters inside JS string literals, useful when writing code that needs to avoid non-ASCII source files or work around encoding issues in older tooling.

Practical Examples

Decoding an Escaped String from an API

Turning \uXXXX sequences back into readable text.

  • 1.Input: Caf\u00e9
  • 2.Decoded: Café

Finding the UTF-8 Bytes of an Emoji

Understanding how 😀 is actually stored.

  • 1.Character: 😀
  • 2.Code Point: U+1F600
  • 3.UTF-8 Bytes: F0 9F 98 80 (4 bytes)

Formats This Tool Converts Between

  • Code Point: U+00E9
  • UTF-8 Bytes: C3 A9
  • HTML Entity (decimal): é
  • HTML Entity (hex): é
  • JS Escape: \u00e9 or \u{1f600} for supplementary characters

Good Use Cases

  • Debugging mojibake or incorrectly decoded text
  • Finding a character's exact code point for a regex or validation rule
  • Converting text to HTML-entity-safe form for legacy systems
  • Understanding why an emoji breaks a naive string-length calculation

Frequently Asked Questions

What's a Unicode code point?

A unique number assigned to every character in the Unicode standard, written as U+XXXX in hexadecimal. 'A' is U+0041, and 😀 is U+1F600.

Why does this tool handle emoji correctly when some don't?

Emoji and many other characters outside the Basic Multilingual Plane are represented in JavaScript strings as surrogate pairs — two 16-bit code units. This tool iterates with Array.from(text), which correctly groups surrogate pairs into a single character, unlike a naive string.split('') loop.

What's the difference between a code point and UTF-8 bytes?

The code point is the abstract number identifying a character. UTF-8 bytes are how that number is actually encoded for storage or transmission — ASCII characters take 1 byte, while characters like é or 你 take 2-4 bytes.

When would I need HTML entities instead of raw Unicode?

When embedding text in HTML where the raw character might not render correctly depending on the document's declared encoding, or when you specifically need an ASCII-safe representation for legacy systems.

What's the difference between \uXXXX and \u{XXXXX} in JavaScript?

\uXXXX only supports exactly 4 hex digits (the Basic Multilingual Plane, up to U+FFFF). \u{XXXXX} with braces supports any valid code point, including characters above U+FFFF like most emoji.

Can I convert HTML entities and JS escapes back to readable text?

Yes — paste them into the decode box at the bottom, and it recognizes &#DDDD;, &#xHHHH;, \uHHHH, and \u{HHHHH} formats and converts them back to the original characters.