fileformer
search⌘KtranslateENexpand_moreupload_fileConvert
Converters8 file families · 44 direct conversions
What changes in a conversionarrow_forward
concepts / text encoding

A file stores numbers.
The encoding says which letters they mean.

Every letter is saved as one or more bytes, and different encodings use different bytes for the same letter. Read a file with the wrong one and "Café" turns into "Café". Type anything below and see the real bytes six encodings would write.

Cafénaïve résuméZürich €5東京 2026ПриветThumbs 👍🏽é vs é
UTF-81992
5 bytesevery character fits
UTF-16LE1996
8 bytesevery character fits
UTF-321999
16 bytesevery character fits
Windows-12521985
4 bytesevery character fits
Shift_JIS1983
4 bytes1 character lost, saved as ?
KOI8-R1993
4 bytes1 character lost, saved as ?
CU+0043
UTF-843
UTF-1643 00
UTF-3243 00 00 00
Win-125243
SJIS43
KOI8-R43
aU+0061
UTF-861
UTF-1661 00
UTF-3261 00 00 00
Win-125261
SJIS61
KOI8-R61
fU+0066
UTF-866
UTF-1666 00
UTF-3266 00 00 00
Win-125266
SJIS66
KOI8-R66
éU+00E9
UTF-8C3 A9
UTF-16E9 00
UTF-32E9 00 00 00
Win-1252E9
SJISnone
KOI8-Rnone
HOW UTF-8 PACKS U+00E9

"é" is number 233, so UTF-8 uses 2 bytes

The first byte starts with 110, saying "this letter takes 2 bytes". Each following byte starts with 10, which never starts a letter, so a reader that lands mid-letter can always find the next one. The 11 remaining slots hold the number itself.

length marker"continues" markerbits of the number
code point in binary
00011101001
11000011
byte 1 = C3
10101001
byte 2 = A9

Saved as one, opened as another

Each row saves the text with one encoding; each column reads those bytes back with another, using this browser's own decoders. The diagonal is the only place it survives. The garbled text has a name: mojibake.

Café €5東京Приветnaïve “quotes”
saved ↓ · read →UTF-8Windows-1252Shift_JISKOI8-RUTF-16LE
UTF-810 bytesCafé €5Café €5Cafテゥ 竄ャ5Cafц╘ Б┌╛5慃썦₩苢㖬
Windows-12527 bytesCaf� �5Café €5Caf� €5CafИ ─5慃耠�
Shift_JIS7 bytes, 2 lostCaf? ?5Caf? ?5Caf? ?5Caf? ?5慃㽦㼠�
KOI8-R7 bytes, 2 lostCaf? ?5Caf? ?5Caf? ?5Caf? ?5慃㽦㼠�
UTF-16LE14 bytesC␀a␀f␀�␀ ␀� 5␀C␀a␀f␀é␀ ␀¬ 5␀C␀a␀f␀�␀ ␀ャ 5␀C␀a␀f␀И␀ ␀╛ 5␀Café €5
Green: read back exactly. Amber on the diagonal: the encoding couldn’t store some characters, so they were already lost when saving. Red: the reader met bytes it couldn’t decode and shows � (U+FFFD).

Which encoding is this file in?

Plain text files rarely say. Programs guess from clues: a byte-order mark at the start, whether the bytes form valid UTF-8, zero bytes every other position. Open a text or CSV file, or try one of the typical cases.

CSV from Excel, "UTF-8"starts with a byte-order mark
Old Windows CSVWindows-1252, no marker
Notepad "Unicode" textUTF-16 little-endian with BOM
Japanese text fileShift_JIS, no marker
Converted twiceUTF-8 read as 1252, then saved as UTF-8 again
check_circle
CSV from Excel, "UTF-8": UTF-8The file starts with the byte-order mark EF BB BF, which settles it. Excel and Notepad write this; many Unix tools and some CSV importers show it as a stray "" in the first cell.
byte-order markUTF-8
valid UTF-8yes
ASCII bytes72.9%
line endingsCRLF (Windows)
read asUTF-8 · guessUTF-16LEUTF-16BEWindows-1252Shift_JISKOI8-R
Name,City,Amount
Zoë Müller,Zürich,€1 250
José Núñez,Málaga,€980
Anaïs Lefèvre,Besançon,€1 105

The encodings you will meet

encodingyearbytes / charletterswhere it still turns up
ASCII19631128The shared base: every encoding below agrees on these 128.
ISO-8859-119871256Old email and HTTP defaults; browsers read it as Windows-1252.
Windows-125219851256Old Windows CSVs and Excel exports, "ANSI" in Notepad.
Shift_JIS19831-2≈7,000Japanese CSVs, older Japanese websites and games.
GB 1803020001-4all UnicodeRequired for software sold in China.
KOI8-R19931256Older Russian email and Unix systems.
UTF-819921-4all 1,114,112Almost all web pages, JSON, source code, Linux and macOS files.
UTF-1619962 or 4all UnicodeInside Windows, Java, JavaScript strings; Notepad "Unicode" files.
UTF-3219994all UnicodeIn memory only; almost never used for files.
Sources: The Unicode Standard 16.0 · RFC 3629 (UTF-8) · RFC 2781 (UTF-16) · WHATWG Encoding Standard (decoder behaviour, windows-1252 for "latin1") · JIS X 0208 · RFC 1489 (KOI8-R) · W3Techs character encoding survey