UTF-16BE to UTF-16LE Converter

Paste UTF-16BE bytes as hex pairs and get the same text as UTF-16LE, the two bytes of every pair swapped.

FluffyShield Protected workspace
FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Free · No upload · No sign-up · No usage quotas

What happens to the byte-order mark when UTF-16BE becomes UTF-16LE?

It's swapped like every other pair, so FE FF turns into FF FE, the little-endian form of the mark.

What the converter does
  1. Split the bytes into pairs
  2. Swap the two bytes inside each pair
  3. Print the bytes 16 to a line

What it does

Emoji stay in order

D8 3D DE 00, one emoji written as two pairs, becomes 3D D8 00 DE. Each half of the emoji is swapped inside itself, and the halves keep their places.

Nothing is checked

The bytes are never read as characters, so half an emoji on its own, D8 3D 00 48, goes through as 3D D8 48 00 without a word.

Limits An odd number of bytes is refused: every UTF-16 character needs whole pairs.

A file that starts FE FF

UTF-16 stores each character as a number held in a pair of bytes, the small numbers a file is made of; a few, emoji among them, take two pairs. Big-endian, UTF-16BE, writes the bigger half of each number first, and little-endian, UTF-16LE, the smaller half first. A program reading the file has to know which.

You have text saved as UTF-16BE, and the program it's going to wants UTF-16LE. Look at the first two bytes. If they're FE FF, the file carries a byte-order mark.

The mark is one particular character, number U+FEFF, put at the very front for a single job. It's never shown, and it reads back as itself only in the byte order it was written in. Read in the wrong order its bytes give U+FFFE, a number Unicode keeps free of any character, so a program that finds it knows the rest needs turning round.

It works like THIS WAY UP printed on a box. Turn the box over and the arrow turns with it, still pointing at the top.

The mark is swapped with everything else

The converter doesn't treat the mark as anything special. It takes the bytes two at a time and swaps each pair, Hi and the mark together.

UTF-16BE inFEFF00480069FFFE48006900UTF-16LE outMark:big-endianMark:little-endian

Every pair swapped

The mark is the first pair. Swapped like the others, it now announces the order the bytes after it are in. How we checked

So the result starts with FF FE, the little-endian mark, and says truthfully what follows. Nothing is added or taken away: 00 48 00 69, with no mark, comes out as 48 00 69 00, still with none.

Swapping your bytes

A file without a mark goes through the same two steps. Settings for other byte layouts are in FluffyBench's Base encoder and decoder.

  1. Paste the big-endian hex into the Input box, mark and all.

  2. Take the swapped bytes from the UTF-16LE box with Copy. Phones show it under Result.

    The UTF-16LE box holding FF FE 48 00 69 00, with Copy and Download above it.
    The UTF-16LE box holding FF FE 48 00 69 00, with Copy and Download above it.

When you read the text back

The mark stays a character once the bytes become text. Put the swapped bytes through UTF-16LE to Text and Hi comes back as 3 characters, the first one invisible. If a program shows a stray symbol before the first word, or a comparison says two equal-looking lines differ, that first character is the likely cause; delete it, or leave out the FF FE before you decode.

You want the words, not the bytes

UTF-16LE to Text Decoder

Paste the converter's result into it as it is; the line breaks between groups of pairs don't matter.

Your bytes are little-endian and need to go the other way

Base encoder and decoder

With From on UTF-16LE and To on UTF-16BE, it makes the same swap in reverse.

Search FluffyBench