Reversible escapes
Keep ordinary ASCII readable while representing multilingual characters predictably in JSON, fixtures, snapshots, and logs.
Free browser-based text converter
Convert Unicode text to readable ASCII, replace or remove unsupported characters, or create reversible \uXXXX escapes. The conversion runs locally in your browser.
Interactive tool
Ready
Escape mode preserves existing ASCII characters and converts only non-ASCII characters.
Conversion guide
Unicode assigns a code point to every supported character. ASCII only covers 128 basic characters, so text containing characters such as é, 你, ☃, or emoji cannot be represented directly in plain ASCII. An ASCII-safe escape writes the character using only ASCII symbols while preserving its Unicode value.
For example, 你 has code point U+4F60 and can be written as \u4F60. Escape mode leaves ordinary ASCII text unchanged, so Hello, 你好! becomes Hello, \u4F60\u597D!. You can also choose brace escapes, HTML entities, or U+ notation.
| Character | Code point | \uXXXX | HTML entity |
|---|---|---|---|
| é | U+00E9 | \u00E9 | é |
| 你 | U+4F60 | \u4F60 | 你 |
| ☃ | U+2603 | \u2603 | ☃ |
| 😀 | U+1F600 | \uD83D\uDE00 | 😀 |
JavaScript strings are Unicode-aware, but JSON and source-code workflows sometimes require ASCII-only source text. The following function preserves existing ASCII and escapes only code points above U+007F. Characters above U+FFFF become the UTF-16 surrogate pairs used by JSON and JavaScript.
function toAsciiEscapes(text) {
return Array.from(text, (character) => {
const point = character.codePointAt(0);
if (point <= 0x7F) return character;
if (point <= 0xFFFF) {
return "\\u" + point.toString(16).toUpperCase().padStart(4, "0");
}
const value = point - 0x10000;
const high = 0xD800 + (value >> 10);
const low = 0xDC00 + (value & 0x3FF);
return "\\u" + high.toString(16).toUpperCase()
+ "\\u" + low.toString(16).toUpperCase();
}).join("");
}
The converter above performs the same kind of encoding in the browser. Select \u{1F600} when you want modern JavaScript code point escapes instead of surrogate pairs, or choose HTML entities when the target is HTML content.
Python's JSON encoder can create ASCII-only output with ensure_ascii=True. This is useful for JSON payloads and fixtures because non-ASCII characters become Unicode escape sequences while ordinary JSON quoting remains valid.
import json
text = "café 你好 😀"
ascii_json = json.dumps(text, ensure_ascii=True)
print(ascii_json)
# "caf\u00e9 \u4f60\u597d \ud83d\ude00"
If you need only the escaped text and not a complete JSON string, account for the surrounding quotes and JSON escaping rules. For production data, keeping the full value returned by json.dumps is usually safer than trimming characters manually.
Transliterate mode converts accented Latin text and common punctuation into readable ASCII. For example, café déjà vu becomes cafe deja vu, curly quotes become straight quotes, and an em dash becomes a hyphen.
Transliteration is lossy and not every writing system has one correct ASCII spelling. This browser-only version does not guess pronunciations for Chinese, Japanese, or other scripts without a direct Latin decomposition. Unsupported characters become ?; use Escape Non-ASCII when exact recovery matters.
Use escapes for reversible code or data, transliteration for readable Latin text, replacement for fixed-width validation, and removal only when losing unsupported characters is acceptable.
Different systems mean different things by “convert to ASCII.” This page exposes the conversion policy instead of silently dropping data, so you can choose a reversible or intentionally lossy result.
Keep ordinary ASCII readable while representing multilingual characters predictably in JSON, fixtures, snapshots, and logs.
Remove Latin accents and normalize punctuation for legacy forms, filenames, search fields, and systems limited to ASCII.
Replace every unsupported code point with ? when the destination must reveal where data was lost.
Strip non-ASCII characters for strict machine fields only when losing those characters will not change important meaning.
Advertisement
Sponsored link