LaTeX Error: Invalid UTF-8 byte sequence

The file is not saved as UTF-8 (often Latin-1 or Windows-1252, from an old editor or a .bib export). Re-save it as UTF-8.

Help centre › LaTeX errors › Files and fonts · Error: the build stops or the output is wrong

What the log says

! LaTeX Error: Invalid UTF-8 byte sequence (^^e9 au).

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.3 Caf^^e9 au
               lait

Also printed as: Package inputenc Error: Invalid UTF-8 byte sequence

What it means

LaTeX reads source files as UTF-8. The file contains a byte that cannot start or continue a UTF-8 character, which almost always means the file was saved in an older 8-bit encoding such as Latin-1 or Windows-1252: an accented letter there is a single byte that UTF-8 does not accept. Older installations report it as a Package inputenc Error.

Causes and fixes

Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.

1. The .tex file is saved in Latin-1 or Windows-1252

Re-save the file as UTF-8 in your editor (most have an encoding choice in Save As), then check that accented letters still look right. The bad example writes the Latin-1 byte for é as ^^e9, which is how TeX shows such a byte in the log.

Fails
\documentclass{article}
\begin{document}
Caf^^e9 au lait
\end{document}
Fixed
\documentclass{article}
\begin{document}
Café au lait
\end{document}

2. The .bib file is not UTF-8

When the error points into the .bbl, the accented name comes from the .bib file, which reference managers sometimes export in Latin-1. Export it again as UTF-8, or write the accents as commands ({\'e} for é) in the .bib.

3. The whole project really is in Latin-1

If you cannot convert an old project, declare its encoding with \usepackage[latin1]{inputenc} in the preamble; every file must then use that encoding. Converting to UTF-8 is the better long-term fix.

In Manulyx

The editor shows the error beside the line with the byte, with an explanation.

Write in Manulyx for free · Journal templates

More in files and fonts

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors