EditSafely

UTF-16 Encode a String

Encode a string as its UTF-16 code units in hexadecimal. Runs entirely in your browser, so your data never leaves your device.

0 chars · 0 lines

Output

The result appears here as you type.

Options

How to use UTF-16 Encode a String

  1. 1. Paste the string. Enter any text into the input pane, including accented characters or emoji. UTF-16 Encode a String converts each character to its 16-bit code unit in hexadecimal.
  2. 2. Set the Separator. Set the Separator to a space, comma, or any character you prefer to join the hex code units together, matching the format your target tool or document expects.
  3. 3. Copy the hex code units. Copy the resulting sequence of hexadecimal code units out of the output pane, ready to paste into a debugger, binary editor, or documentation of the encoding.

When to use UTF-16 Encode a String

UTF-16 Encode a String converts text into its raw UTF-16 code units, shown as hexadecimal values. Use it whenever you need to see the exact 16-bit values a string produces, particularly for characters that require surrogate pairs.

  • Preparing test data for a native application. You are writing a test for code that consumes wide-character strings and need the exact UTF-16 hex code units for a sample input to hard-code into the test.
  • Checking how an emoji encodes as a surrogate pair. You want to see the two 16-bit code units that make up an emoji or other character outside the basic multilingual plane, to understand or debug surrogate pair handling.
  • Documenting an encoding for a file format spec. You are writing documentation for a binary format that stores UTF-16 strings and need the exact hex code units for an example string to include in the spec.
  • Comparing UTF-16 output against UTF-8. You want to see how the same string encodes differently in UTF-16 versus UTF-8, particularly for characters that take more bytes in one encoding than the other.

Examples

Encode

Input

Output

0041 00c9

About the UTF-16 Encode a String tool

UTF-16 Encode a String does its work locally, right in the browser. Encode a string as its UTF-16 code units in hexadecimal. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the String Tools collection on EditSafely, a set of 159 small, focused String utilities that share the same instant, private workspace.

You can shape the output with the Separator setting, and the result refreshes the moment you change it. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Does UTF-16 Encode a String cost anything?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How much text can I process at once?

There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.