Write text as Unicode escapes for source code
Properties files, JSON strings, HTML entities — convert non-ASCII text to escapes and read escapes back.
Tools used in this guide
The job
Some formats cannot safely carry raw non-ASCII text: Java `.properties` files historically expect \uXXXX, JSON strings are portable as escapes, and HTML numeric entities survive encoding mishaps. The other direction matters too — reading a log line full of \u3042 escapes as actual Japanese.
How to do it
Pick the direction. When escaping, choose the notation your target expects: \uXXXX for JavaScript/Java-style strings, \u{…} for ES6 code points, &#x…; entities for HTML, or \xNN UTF-8 bytes for byte-level tools. Non-ASCII characters are escaped by default; tick the option to escape everything.
- Emoji and other characters above U+FFFF need either a surrogate pair or the \u{…} form — the tool picks correctly per format.
- Unescaping accepts all four notations plus decimal entities, so mixed input still decodes.
- Everything is converted in the browser — paste source fragments without worrying where they go.
Worked example
「こんにちは」 escaped as \uXXXX becomes \u3053\u3093\u306b\u3061\u306f — safe to paste into a .properties file. Pasting that back on the unescape side returns こんにちは.
Limits
A \xNN run is decoded as UTF-8; if the bytes are not valid UTF-8 they are shown as Latin-1 characters instead of erroring. The tool cannot distinguish a real escape from literal text that merely looks like one — "a\u0041test" always decodes the \u0041. Input is capped at 100,000 characters.