Fix Overfull \hbox too wide warnings in Overleaf.
An overfull horizontal box warning means a line of text, an inline equation, or a table column spills past your right margin. TeX generates the PDF anyway, but the spilled content can clip off the page or crowd adjoining columns.
The short answer: add \usepackage{microtype} to your preamble first, because font expansion resolves most small overflows automatically. For long technical terms, insert manual hyphenation points with \-; for long URLs, load \usepackage{xurl}.
What an overfull hbox warning actually means
TeX builds paragraphs by assembling characters and spaces into horizontal boxes called hboxes, then stacking those lines vertically into vboxes. During paragraph breaking, the Knuth-Plass algorithm searches for line breaks that balance word spacing across the entire paragraph. When a line contains an unbreakable element or lacks valid hyphenation points, TeX cannot shrink the spaces enough to fit the line within \linewidth.
Rather than clipping the line or stretching words into an unreadable mess, TeX lets the excess material spill into the right margin and records a diagnostic warning in the .log file. A message like Overfull \hbox (14.28105pt too wide) in paragraph at lines 42--47 tells you that the line sticks out by roughly 5 millimeters. If the warning reports less than 1 or 2 points, the overflow is rarely noticeable to the human eye, whereas an overflow of 20 points or 117 points creates an obvious visual blemish in your document.
Diagnosing the cause at a glance
| Symptom or width | Likely cause | Fastest remedy |
|---|---|---|
| Under 3 pt overflow in running prose | Slight spacing constraint in justified text | Load \usepackage{microtype} in the preamble |
| 10 to 30 pt overflow on a single long word | Missing hyphenation rule for technical term | Insert discretionary hyphens with \- |
| 50 to 150 pt overflow on link or path |
How to locate the overflowing line in Overleaf
| Standard preamble | Draft debugging preamble |
|---|---|
\documentclass{article} | \documentclass[draft]{article} |
\documentclass[11pt]{report} | \documentclass[11pt,draft]{report} |
Overleaf marks bad boxes with a yellow warning triangle in the log pane. Clicking the warning jumps the text editor to the paragraph containing the overflow, but pinpointing the exact word on the typeset page can still take time when the paragraph runs across six or seven lines.
Seven practical fixes for overfull hbox warnings
Work through these solutions starting from the cleanest typographic adjustments down to emergency overrides.
1. Load microtype for font expansion and protrusion
The
microtypepackage enables character protrusion (hanging punctuation into the margin by a fraction of a millimetre) and font expansion (stretching or shrinking letter shapes by up to two percent). These subtle optical adjustments give TeX extra flexibility when justifying text, clearing up the majority of small overfull warnings without altering wording.% Add this to your preamble \usepackage{microtype}2. Add manual hyphenation hints to stubborn words
TeX's hyphenation dictionary skips words containing slashes, underscores, or accented characters, as well as specialised scientific vocabulary. Inserting
\-tells TeX where it may break the word if necessary. If the word appears frequently throughout the manuscript, declare its hyphenation pattern once in your preamble.% For a single occurrence: electro\-enceph\-a\-log\-ra\-phy % For the entire document in the preamble: \hyphenation{electro-enceph-a-log-ra-phy non-smooth}3. Handle long URLs and web links with xurl
Standard LaTeX URLs often run straight into the margin because the default
urlpackage only allows line breaks after slashes and dots. Loadingxurlallows breaks after any alphanumeric character, preventing wide overfull hboxes in bibliographies and footnotes.
Setting global tolerance and emergency stretch
If your document contains numerous narrow blocks, you can adjust TeX's tolerance globally in the preamble. Setting \emergencystretch gives TeX permission to perform an additional formatting pass with looser spacing before giving up and overflowing into the margin.
Add \emergencystretch 3em to your preamble. Unlike the blanket command \sloppy, which turns off formatting rigor across the whole paper and produces loose gaps between ordinary words, setting a moderate emergency stretch only takes effect when a line genuinely cannot fit.
Questions
Can I submit a paper to an IEEE or Springer journal with overfull hbox warnings?
Yes, provided the text does not visually overlap column dividers or spill into the page trim. Journal editorial systems parse .log files and often flag warnings, but minor overflows under 2 points are normally tolerated during initial review. Always eliminate larger overflows where text visibly encroaches on the margin.
What is the difference between an overfull hbox and an underfull hbox?
An overfull hbox means there is too much material to fit inside the line, pushing text into the margin. An underfull hbox means there is too little material, forcing TeX to stretch inter-word spaces excessively to reach the right margin, often reported with a badness value up to 10000.
Try your own paper in Texeno.
Start free, upload a project as a .zip and press Recompile. Upgrade when you need longer compiles.
Start writing