press ⌘K to switch tools
ENCODE & DECODE
JavaScript Hex String Escape
Escape and unescape JavaScript hex string sequences.
js-hex-escape
§01 ABOUT THIS TOOL
Overview
JavaScript string literals can represent any character with hex escapes: \xNN
for single bytes, \uNNNN for the Basic Multilingual Plane, and \u{NNNNN} for
code points beyond it. This tool converts text to those sequences and back —
useful for embedding non-ASCII text in source files, inspecting obfuscated
strings, or debugging encoding issues.
How to use
- Pick Escape to convert plain text, or Unescape to decode escape sequences.
- Type or paste into the Text (or Escaped) field. The Result updates instantly.
- In Unescape mode, an
Invalid escape sequenceerror appears if the input cannot be parsed.
Examples
café→caf\xe9日本語→\u65e5\u672c\u8a9e\u{1f310}→🌐
Notes
Printable ASCII characters (except the backslash itself) pass through unchanged, so output stays readable. This is escaping, not encryption — anyone can reverse it. When decoding untrusted strings, remember the result is still plain text; nothing is executed.
FAQ
Is my text sent to a server?
No. Escaping and unescaping run entirely in your browser with plain JavaScript string processing. Nothing is uploaded or stored.
Which escape forms does the tool produce?
Printable ASCII stays as-is. Code points up to 0xFF become \xNN, up to 0xFFFF become \uNNNN, and anything above (emoji, rare CJK) becomes the ES2015 form \u{NNNNN}.
Can it decode all three forms at once?
Yes. Unescape mode resolves \u{...}, \uNNNN, and \xNN sequences in a single pass, so mixed input decodes correctly.