Zero Width No-Break Space (U+FEFF)
U+FEFF is the byte order mark: it signals the encoding at the start of a file and acts as an invisible no-break space elsewhere.
U+FEFFCf · formatzero width
Need the code?HTML, CSS, JS escapesFind it in text
An app result is shown only after a hand test on a named app version, with the date. Results older than 120 days are hidden until re-tested.
Read the method →What is the Zero Width No-Break Space used for?
The Zero Width No-Break Space (U+FEFF) is used mostly as the byte order mark: at the start of a text file it tells software which encoding and byte order the file uses. In UTF-8 it is the bytes EF BB BF. Its old use as an invisible no-break space is deprecated in favor of U+2060.
Its Unicode name is Zero Width No-Break Space, with the aliases BOM and ZWNBSP. It is in the Arabic Presentation Forms-B block and dates from Unicode 1.1.
The Unicode BOM FAQ explains its first job. In UTF-8 it is the bytes EF BB BF, and at the start of a text stream it tells software which encoding and byte order the text uses.
In the middle of text it should be treated as a zero width no-break space. The names list says that use is deprecated, and points to U+2060 Word Joiner instead.
Unlike the other zero-width characters, JavaScript's trim() removes it. The ECMAScript standard lists U+FEFF as white space, even though Unicode does not give it the White_Space property.
Watch out for
- A stray BOM at the start of a CSV or script file can break the first column name or the first line of code.
- It draws nothing, so the detector is the quickest way to see whether a text starts with one.
- In UTF-8 it takes 3 bytes (EF BB BF).
Sources: Unicode FAQ: UTF and BOM · Unicode names list (NamesList.txt) · Unicode blocks (Blocks.txt) · Unicode version each character arrived (DerivedAge.txt) · ECMAScript: white space · Unicode properties (PropList.txt) · Computed from the character itself (see Codes and escapes)
Codes and escapes
| Format | Value | Copy |
|---|---|---|
| HTML entity |  ·  | |
| CSS | \FEFF | |
| JavaScript / Java | \uFEFF | |
| Python | \uFEFF | |
| URL-encoded | %EF%BB%BF | |
| UTF-8 bytes | EF BB BF |
Properties
- Unicode category
- Cf (Format)
- Treated as whitespace
- No
- Width
- Zero
- Unicode name
- ZERO WIDTH NO-BREAK SPACE (BOM)
Where it works
Not tested yet. Results appear here with the app version and date once each app is tested by hand.
Similar characters
FAQ
What is the byte order mark?
The byte order mark is the character U+FEFF placed at the start of a text stream. It tells software which encoding and byte order the text uses; in UTF-8 it is the bytes EF BB BF. Anywhere else in the text it is treated as a zero width no-break space.
How do I remove a BOM from text?
To remove a BOM from text, paste it into the detector, which marks the U+FEFF at the start and deletes it in one tap. In JavaScript, text.replace(/^\uFEFF/, '') strips one at the start of a string. Many editors can also save a file as UTF-8 without a BOM.
Why does trim() remove U+FEFF but not other zero-width characters?
JavaScript's trim() removes U+FEFF because the ECMAScript standard lists it as white space by name. Unicode itself doesn't give it the White_Space property, and other zero-width characters such as U+200B aren't on ECMAScript's list, so trim() leaves them in place.