Reduce repeated empty paragraphs in Writer while keeping single gaps
By ON Lab · Sources checked November 8, 2026
To reduce pairs of empty paragraphs in Writer while leaving a single empty paragraph, a three-stage marker replacement can work on plain text. Test it on a copy: the procedure reduces a run of three empty paragraphs to two on its first pass, not directly to one. Check that the temporary marker is absent before replacing anything.
A reader wanted to replace repeated empty paragraphs without removing intentional single gaps and without installing an extension. The forum already provides the marker procedure below. We tested its actual paragraph counts in native Writer 26.8.2.2 on macOS arm64, including runs from zero to six empty paragraphs and whitespace-only controls. This guide adds the measured limits; it does not present the workaround as a new invention.
First identify the kind of gap
Display formatting marks and inspect the passage. An empty paragraph, a paragraph containing a space, a manual line break and paragraph spacing are different things. The regular expression ^$ targets an empty paragraph. It is not a command to remove all visible white space.
In our native test, paragraphs containing one ordinary space or one tab produced zero matches for ^$. If your gap comes from paragraph formatting, this text-replacement procedure is the wrong tool. If it comes from a manual line break, do not assume the same paragraph-boundary expression applies.
What one complete pass actually did
Each test document contained a START paragraph, a known number of empty paragraphs and an END paragraph. The following are the empty-paragraph counts between those two labels after applying all three stages.
| Before | After one complete pass | After two complete passes |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 1 | 1 |
| 3 | 2 | 1 |
| 4 | 2 | 1 |
| 5 | 3 | 2 |
| 6 | 3 | 2 |
A single gap remained single, and text with no empty paragraph did not acquire one. Longer runs were reduced in pairs. This is useful if that is your desired transformation. It is not a way to select only runs of exactly two while leaving every longer run untouched, and one pass is not a promise that every long run becomes one.
We executed Writer's native replaceAll interface from an original local test macro in an isolated profile. We did not install a third-party extension, execute a forum macro, click the Find and Replace dialog, or inspect the reader's document. The tests used plain body paragraphs, not mixed formatting, tables, frames, fields or footnotes.
Prepare a working copy and a genuinely unused marker
- Save a separate working copy and keep the original unchanged.
- Start with a small plain-text sample containing a single gap and a double gap, so you can check both preservation and reduction.
- Use ordinary text search to confirm that
ZZZEMPTYZZZis absent from the intended document or passage. - If that text already occurs, choose another simple letter-only marker and substitute it consistently in all three stages.
The marker is temporary data, not an invisible command. A later stage replaces its occurrences. If legitimate text already contains the marker, the procedure can alter that text too. Do not proceed merely because the marker looks unusual.
Our test used the complete small test document. Writer also documents a Current selection only search option, but we did not reproduce selection boundaries through the dialog. Validate any selected-passage workflow on a copy before relying on it in a longer document.
Apply the three stages in order
Open Edit → Find and Replace and enable regular expressions. Clear unrelated formatting or style restrictions from the search so the small sample matches the intended plain-text case. Keep the temporary marker identical at each stage.
| Stage | Find | Replace |
|---|---|---|
| 1 | ^$ | ZZZEMPTYZZZ |
| 2 | ZZZEMPTYZZZ$ | Leave the replacement box completely empty |
| 3 | ZZZEMPTYZZZ | \n |
Use Replace All for each stage within your validated scope, checking the result before proceeding to the next one. In the third replacement box, type one backslash followed by the letter n. The code display above represents that two-character entry; do not type quotation marks around it.
Writer's regular-expression help distinguishes this replacement use of \n from searching for a manual line break. In a Writer replacement it inserts a paragraph break. This is a Writer procedure; the same replacement text is not a transferable Calc instruction.
Do not stop after inserting markers and save the document as a finished cleanup. Complete the stages, then search for the marker again. Unexpected remaining markers or altered nonempty text are reasons to undo the experiment or return to the unchanged original, not reasons to run more replacements blindly.
Check both the gaps you changed and the gaps you intended to keep
After one complete pass, our single empty paragraph was still one and our double was one. Our triple was two. If you need all longer runs reduced to a single gap, inspect the remaining runs and test another complete pass. In our matrix, five and six became two after the second pass, so even two passes did not normalize every tested run to one.
Compare the START and END text, count the paragraph marks between them, and verify that ordinary nonempty paragraphs retain their contents. Then save the working copy, reopen it and inspect the result before replacing the original. A lower page count alone does not prove that the intended text survived.
For a complex document, merging paragraph boundaries may affect layout or formatting. Our plain-text test does not establish preservation of paragraph styles, anchored objects or other structures. Use a smaller scope or manual edits when those structures matter and you cannot verify the outcome.
When to use paragraph spacing instead
The marker method can help clean up imported plain-text passages that already contain empty paragraphs. For ongoing document layout, consider paragraph spacing and styles so that edits do not depend on counting empty spacer paragraphs. That is a separate formatting decision, and it does not justify deleting intentional gaps without checking their purpose.
If your requirement is to remove only a particular type of double gap, preserve longer runs exactly, or operate across tables and notes, this fixture is not sufficient evidence. Keep the original and make a matching sample first rather than assuming that a successful plain-text replacement proves the broader case.