Convert text to \\uXXXX Unicode escape notation

Represent Unicode characters with JavaScript-compatible escape sequences.

freeworks offlinenothing uploaded
ToolUnicode Escape
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Unicode characters are represented with escape notation such as \uXXXX or code-point escapes, preserving the underlying scalar value when decoded. Surrogate-pair notation and code-point notation are distinct source forms for characters outside the BMP.

  • Four-hex-digit escapes match UTF-16 code units; brace escapes represent a full code point.

Worked example

Escape Non-ASCII
Convert non-ASCII characters to \uXXXX notation
Input
											café naïve
										
Output
												caf\u00E9 na\u00EFve
											

When to use this

ASCII-only source files, invisible-character fixtures, and Unicode tests use escapes.

Edge cases

  • An astral character needs two UTF-16 escapes or one code-point escape.
  • A lone surrogate is not a valid Unicode scalar value.
  • JavaScript escaping does not make text safe for HTML or URLs.

References