Text Encoding Converter
Open a text file to detect its character encoding, preview it correctly, and save it again as UTF-8, UTF-16, Windows-1252 or ISO-8859-1 with the line endings you choose. Files never leave your browser.
1. Source
2. Target
How to use the Text Encoding Converter
- Open a file (or switch to Paste text). The detected encoding, BOM and line endings appear immediately.
- Check the preview. If accented letters look wrong (for example é instead of é), pick a different source encoding from the list.
- Choose the target encoding, whether to add a BOM and which line endings to use.
- Press Convert and review the result. Characters that the target encoding cannot store are listed with their line numbers.
- Download the converted file.
How encodings store the same text
The word café uses four characters, but each encoding writes them as different bytes. Only the é changes in the 8-bit encodings; UTF-16 uses two bytes for every character.
| Encoding | Bytes for "café" (hex) | Size |
|---|---|---|
| UTF-8 | 63 61 66 C3 A9 | 5 bytes |
| UTF-8 with BOM | EF BB BF 63 61 66 C3 A9 | 8 bytes |
| UTF-16 LE with BOM | FF FE 63 00 61 00 66 00 E9 00 | 10 bytes |
| UTF-16 BE with BOM | FE FF 00 63 00 61 00 66 00 E9 | 10 bytes |
| Windows-1252 / ISO-8859-1 | 63 61 66 E9 | 4 bytes |
This is why the wrong source encoding produces garbage: reading the UTF-8 bytes C3 A9 as Windows-1252 shows two characters, é, and reading the single Windows-1252 byte E9 as UTF-8 is invalid and shows �.
How detection works
- Byte order mark. A file starting with
EF BB BFis UTF-8,FF FEis UTF-16 LE andFE FFis UTF-16 BE (four-byte marks indicate UTF-32). This is certain. - UTF-16 without a BOM. English or code written in UTF-16 has a zero byte in every other position, which reveals the byte order.
- UTF-8 validation. UTF-8 multi-byte sequences follow strict rules. Text with accented letters that passes this check is almost certainly UTF-8, because legacy text rarely forms valid sequences by accident.
- Legacy fallback. Anything else is treated as Windows-1252, the most common 8-bit encoding. If the preview shows wrong letters, choose the right code page, such as Windows-1251 for Russian or Windows-1250 for Polish and Czech.
Common conversions
| Task | Source | Target settings |
|---|---|---|
| Fix accents in an old CSV or subtitle (.srt) file | Windows-1252 | UTF-8, no BOM |
| Make Excel open a CSV with accents correctly | UTF-8 | UTF-8 with BOM, CRLF |
| Remove a BOM that breaks a PHP, JSON or shell file | UTF-8 with BOM | UTF-8, BOM unticked |
| Read a Windows "Unicode" .txt export | UTF-16 LE | UTF-8, LF |
| Feed a legacy system that only accepts ANSI | UTF-8 | Windows-1252 (check the list of unmappable characters) |
Frequently asked questions
How do I convert a file to UTF-8?
Open the file, check that the preview shows the text correctly, choose UTF-8 as the target and press Convert, then Download. If the preview shows odd characters, change the source encoding first, because the conversion can only be as correct as the decoding.
Should I save UTF-8 with or without a BOM?
Without a BOM for almost everything: web pages, source code, JSON, CSV for most tools and Linux or macOS programs. Add a BOM mainly when Microsoft Excel must open a CSV file with accented characters correctly, or for some older Windows programs.
Why do I see characters like é or ’ in my text?
That is mojibake: UTF-8 bytes being read as Windows-1252. For example é is stored in UTF-8 as two bytes, C3 A9, which Windows-1252 shows as é. Select UTF-8 as the source encoding to read the file correctly.
Can encoding be detected with 100% certainty?
Only when the file has a byte order mark or contains non-ASCII text that is valid UTF-8. Legacy 8-bit encodings such as Windows-1252, Windows-1251 and ISO-8859-2 use the same bytes for different letters, so the tool makes a best guess and lets you pick another encoding if the preview looks wrong.
What is the difference between Windows-1252 and ISO-8859-1?
They are identical except for bytes 0x80 to 0x9F. Windows-1252 uses them for printable characters such as €, curly quotes and the long dash, while ISO-8859-1 reserves them for control codes. Text often labelled ISO-8859-1 is really Windows-1252.
What happens to characters the target encoding cannot store?
Windows-1252 and ISO-8859-1 can store only 256 characters. Anything else, such as emoji, Chinese or Polish letters like ł, is replaced by a question mark, an HTML numeric entity or removed, depending on your choice, and each one is listed so nothing is lost silently. UTF-8 and UTF-16 can store every character.