Unicode Text Encoder

This tool allows you to type in any Unicode text or Emoji and encode it into HTML, JavaScript, and other programming languages.

Escaping Options

Use ES6 escapes
Capitalize
Skip printable ASCII
Use 2-digit for ASCII

Encoded JavaScript

About our JavaScript text encoder

In JavaScript, there are three ways to escape Unicode characters in your source files. Text is

  • For the first 256 characters in the range 0x00 to 0xFF -- ASCII or basic latin -- you can use two hexadecimal digits like:
    \x63
    • Hexadecimal codepoints must be 2 characters
    • Hexadecimal codepoints are case insensitive
  • For characters in the range 0x0100 to 0xFFFF you can use the following form
    \uXXXX
    • Hexadecimal codepoints must be 4 characters
    • Hexadecimal codepoints are case insensitive
  • For characters 0x10000 and above, these are known as supplementary or astral plane codepoints. Typically you would have to encode them with a surrogate pair of codepoints, but with the newer ES6 Javascript support you can use the following escape sequence:
    \u{XXXXX}

References