Byte Order Mark
The byte order mark (BOM) is the U+FEFF character placed at the start of Unicode text to indicate the encoding form and byte order.
Purpose
It lets a decoder auto-detect the text encoding and byte order without external metadata.
Mechanism
Different encodings produce different BOM byte sequences: UTF-8 = EF BB BF, UTF-16LE = FF FE, UTF-16BE = FE FF, UTF-32LE = FF FE 00 00, UTF-32BE = 00 00 FE FF. A decoder reads the first 2-4 bytes and matches them.
Use cases
- Encoding detection in text editors
- Cross-system text file exchange
- Encoding identification for database imports
- CSV file handling in Excel
Examples
- Input
UTF-16LE fileOutputFF FE ...Leading bytes FF FE indicate little-endian UTF-16
Common errors
- Mistaking a UTF-8 BOM for data content
- Detect and strip the BOM when reading
Related terms
BOM
The BOM (byte order mark) is the Unicode character U+FEFF, placed at the start of a text stream to indicate the encoding form and byte order. GLOSSARY
Endianness
Endianness is the byte ordering of multi-byte values in memory: big-endian stores the most significant byte first, little-endian the least significant byte first. GLOSSARY
UTF-16
UTF-16 is Unicode's variable-length encoding form, using 2 or 4 bytes per code point: BMP characters take one 16-bit code unit and supplementary-plane characters take a surrogate pair (2 code units). GLOSSARY
UTF-8
UTF-8 is Unicode's variable-length encoding form, using 1 to 4 bytes per code point; it is fully backward compatible with ASCII and is the de facto standard for the web and modern systems. GLOSSARY
Related tools
Encoding Detector
Check text encoding: ASCII subset, UTF-8 BOM, and non-ASCII characters. Text input is always re-encoded as UTF-8, so legacy encodings (GBK/Big5/Shift-JIS) cannot be distinguished — the tool honestly reports the UTF-8 byte form. Free, private, 100% client-side. TOOL
Charset Reference
Reference table of character encodings. Free, private, 100% client-side. TOOL