Unicode Escape Encoder

Encode text as JavaScript-style UTF-16 Unicode escapes.

Your workspace

Processed in your browser

Enter your values or try the example.

This utility transforms plain text into JavaScript-compatible Unicode escape sequences. It is useful for ensuring characters display correctly in environments where specific encoding or character escaping is required.

How to encode text

  1. Paste the text you want to encode into the input field.
  2. The tool automatically generates the escaped output, replacing special characters with their corresponding \uXXXX or surrogate pair sequences.

Handling supplementary characters

Characters outside the Basic Multilingual Plane (like certain emojis) are represented using surrogate pairs (two consecutive \uXXXX escapes). This ensures compatibility with standard JavaScript string literals.

Example output

Hi

\u0048\u0069

Common questions

Does this tool encrypt my data?

No. This is a simple encoding utility for character representation, not a security or encryption tool.

Why do some characters result in two escape sequences?

Characters outside the standard BMP range require surrogate pairs in UTF-16, resulting in two combined escape sequences.

Continue your workflow

Explore more tools in this category for your next step.