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.
Purpose
It signals big- or little-endian byte order in UTF-16/UTF-32, and serves as an encoding signature in UTF-8 (even though UTF-8 has no byte-order ambiguity).
Mechanism
U+FEFF is rendered into bytes by the encoding form: EF BB BF in UTF-8, FF FE in UTF-16LE, and FE FF in UTF-16BE. A decoder reads the first few bytes and matches them against known BOMs to determine the encoding. U+FEFF itself is a zero-width no-break space, which is why it can double as a signature.
Use cases
- Automatic text file encoding detection
- Cross-platform text exchange
- Encoding markers for CSV/TSV files
- Encoding of database export files
Examples
- Input
UTF-8 BOMOutputEF BB BFThe first three bytes of a file
Common errors
- A UTF-8 BOM being rejected by a JSON parser (RFC 8259 forbids it)
- Do not use a BOM in JSON files
Related terms
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
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
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
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. GLOSSARY
Unicode
Unicode is the international character encoding standard that assigns a unique code point (U+0000 through U+10FFFF) to every character of nearly all the world's writing systems, with a codespace of 1,114,112 code points. 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
File Add BOM
Add UTF-8 BOM to file content. TOOL
File Strip BOM
Strip UTF-8 BOM from file content. TOOL