Widow & Orphan Detector
Text & measure
The simulation measures each word with the Canvas API at the given size and stacks lines until they exceed the measure, so the line count and the stranded words are estimated from real metrics rather than character counts.
Paragraph report
| # | Lines | Last line words | Average fill | Flag |
|---|---|---|---|---|
| 1 | 4 | 10 | 96% | clean |
| 2 | 4 | 8 | 95% | clean |
| 3 | 3 | 4 | 97% | clean |
Preview
The pull of a baseline grid is that it makes every page look decided rather than assembled. But a grid is only as good as the exceptions it allows: a figure that breaks a column, a heading that opens a new page, a paragraph whose final line carries only one word.
A single word alone on a line is the classic widow, and a first line broken off from its paragraph is an orphan. Both are corrected the same way: by adjusting the measure, the leading or the text, rather than by punishing the reader with more rules.
Typesetting software can reflow a paragraph automatically to remove them; CSS can only ask politely, with widows and orphans, and browsers honour those hints unevenly.
.prose {
font-size: 1.0625rem;
line-height: 1.6;
max-width: min(100%, 600px);
widows: 2; /* lines that must remain together at the start of a fragment */
orphans: 2; /* lines that must remain together at the end */
text-wrap: pretty; /* where supported: avoids short last lines automatically */
}
.prose p + p { margin-top: 0.9em; }You Might Also Need
The widow and orphan detector measures a paragraph in the real face at the real size, simulates the line breaks and reports which paragraphs are at risk of a single-word last line. You set the size, the measure, the line height, the widows and orphans value and the font stack, then paste the copy; the panel returns counts of widows, orphans and short last lines with a per-paragraph breakdown.
What is Widow & Orphan Detector?
The widow and orphan detector is a measurement tool rather than a style generator. It takes the size, the measure in pixels, the line height, the widows and orphans value and a free-text font stack, then splits the pasted text into paragraphs and analyses each one. The report counts single-word last lines, short first lines and short last lines, and a table gives every paragraph its line count, the number of words on its final line, its average fill and a flag.
- Report columns: the paragraph number, its line count, the words on the last line, the average fill percentage of the preceding lines, and a flag of widow, orphan, short last line or clean.
- Widows and orphans from 1 to 4, defaulting to 2, written into the generated rule as both properties.
- Measure from 240px to 1200px, defaulting to 600px; size from 12px to 28px, defaulting to 17px; line height from 1.2 to 2.4.
- A font stack field that accepts any CSS family list, defaulting to Source Serif 4 with Georgia and serif fallbacks.
- A short last line is flagged when the final line fills less than a quarter of the measure, and an orphan when the first line is similarly short.
- The generated rule adds widows, orphans, text-wrap: pretty and a paragraph spacing value of 0.9em.
The measurement is a greedy line-break simulation driven by the Canvas measureText call. Each word is measured at the chosen pixel size and font stack, the widths accumulate with the space width until the measure is exceeded, and the break is taken at the last word that fits, which reproduces how a browser fills a paragraph without hyphenation or justification. The average fill figure divides the summed widths of every line except the last by the number of those lines times the measure, so a paragraph that is comfortable throughout but ends badly is distinguished from one that is loose everywhere. When no Canvas context is available, the detector falls back to a rough half-em advance per character and says so.
- The simulation is greedy and unhyphenated, so a browser with hyphenation or justification enabled will break the paragraph differently.
- Canvas measurement depends on the face being loaded; an unloaded webfont measures in the fallback stack.
- CSS widows and orphans are hints, honoured unevenly across engines, and a value of 2 is not a guarantee.
- text-wrap: pretty is recent, and engines without it ignore the declaration.
- A paragraph of only one line can never be flagged, so very short copy passes without a verdict.
Run it when long copy is about to ship inside a fixed measure: an article body, a documentation column, a printed column. Fix the paragraphs it flags rather than adding rules across the whole site, since the corrections are local: a slightly different measure, a small change in leading, or a reworded sentence. The detector reports the outcome of the first two immediately because it re-measures whenever a slider moves. A paragraph that width alone cannot fix is the case the justification previewer and the hyphenation tester address, and the same logic applied across several columns is what the column layout builder checks.
How to use Widow & Orphan Detector
- Set the size, the measure and the line height the copy will actually ship at.
- Choose the widows and orphans value and paste the font stack the page uses.
- Paste one paragraph per line break and read the counts and the per-paragraph table.
- Copy the generated rule, or adjust the measure until the flagged paragraphs come back clean.
When to use Widow & Orphan Detector vs related tools
Reach for it when copy is about to be set in a fixed measure and the last lines are the risk: an article body, a documentation column, a print column. It converts a judgement call into a count, and it reports the two corrections that usually work, a different measure and a different leading, as soon as they are tried. A paragraph that breaks badly because of long words is the hyphenation tester's problem, and the text justification previewer explains why a tight measure with no hyphenation produces rivers. The text edge itself, independent of the paragraph's last line, is what the optical margin alignment preview examines.
Privacy & Security
This tool runs entirely in your browser — no data ever leaves your device. There is no server round-trip, no upload, no logging, and no account required. Your input is processed locally using client-side JavaScript and is never stored, transmitted, or accessible to anyone else. When you close the tab, everything disappears.