> Source: https://txtfetch.com/glossary/byte-order-mark > Plain-text twin — every page on txtfetch.com has one. https://txtfetch.com/text --- # Byte order mark (BOM) A few invisible bytes at the start of a text file declaring its encoding and byte order. Helpful for a reader, a stray character if a parser doesn't strip it. definition A byte order mark (BOM) is an optional sequence of bytes placed at the start of a text file. It declares the file's encoding and, for multi-byte encodings, the byte order used. Also called: BOM, UTF-8 BOM in-plain-terms UTF-16 can store each character's bytes in two different orders. A reader has no way to tell which one a file uses without being told. The BOM's job is to say so before any real content begins. UTF-8 doesn't need a BOM for this reason, since it has no byte-order ambiguity. But some tools write one anyway, mostly for legacy compatibility. A reader that doesn't recognize and strip the BOM treats it as ordinary content. It shows up as an invisible or oddly-rendered character glued to the very first word of the file. This is a common, easy-to-miss extraction artifact. why-it-matters - A stray BOM at the start of extracted text can silently break an exact-match comparison or a first-line parser. It can also break a chunk boundary that assumes the file starts cleanly. - Detecting and stripping the BOM correctly is also how a reader knows which encoding and byte order to apply to the rest of the file. Get it wrong and every character after it can decode incorrectly too. how-to-check - Check the first few bytes of a text file for a UTF-8 or UTF-16 BOM signature before assuming the file starts with real content. related-terms - [Character encoding →](https://txtfetch.com/glossary/character-encoding) - [Mojibake →](https://txtfetch.com/glossary/mojibake) faq **Does every UTF-8 file have a BOM?**: No. A BOM is optional in UTF-8 and isn't needed for it, since UTF-8 has no byte-order ambiguity to resolve. Some tools write one anyway for legacy compatibility, which is why a reader still needs to detect and strip it. **What happens if a BOM isn't stripped?**: It gets treated as ordinary content. It typically shows up as an invisible or oddly-rendered character glued to the very first word of the extracted text. That can break an exact-match comparison or a first-line parser downstream. related-reading - [Extract text from CSV →](https://txtfetch.com/extract/csv) - [Fix: mojibake and wrong-encoding text →](https://txtfetch.com/fixes/mojibake-wrong-encoding) - [All glossary terms →](https://txtfetch.com/glossary) Characters & encoding - [Character encoding →](https://txtfetch.com/glossary/character-encoding) - [Mojibake →](https://txtfetch.com/glossary/mojibake) - [Ligature →](https://txtfetch.com/glossary/ligature) - [Replacement character →](https://txtfetch.com/glossary/replacement-character) - [All terms →](https://txtfetch.com/glossary) ## See the term in real output. Drop a file into the free reader and watch it happen. [Open the file reader →](https://txtfetch.com/tools/file-to-text) [Get an API key →](https://app.txtfetch.com/signup)