← Blog & Guides/Google Workspace

How to Remove Line Breaks in Google Docs (Find & Replace + Regex)

Google Docs stores every Enter as a paragraph break and every Shift + Enter as a line break — so text pasted from a PDF, an email, or a chat arrives as dozens of slivered lines. This guide shows every working method, from plain Find & Replace to paragraph-safe regex patterns.

By Google Workspace Team•10 min read•2,000+ words•
Google Docs page with hard line breaks being cleaned into flowing paragraphs using find and replace
📝Docs cleanup flow: Wrapped lines and stray hard returns are merged back into clean paragraphs while greetings, lists, and section breaks stay exactly where you put them.

Why Google Docs Is Full of Line Breaks

Google Docs has no margins of its own — it stores exactly what you paste. Every newline that came with your text becomes a permanent part of the document, rendered as either a paragraph break or a line break depending on which key created it.

Three sources cause most of the mess. Copied web and PDF text carries the source's hard wraps, so a 60-character margin in the original becomes 60-character fragments in your Doc. Email and chat copy brings plain-text line structure that was never meant for a word processor. And manual editing habits — pressing Enter at the end of every visual line instead of letting Docs wrap — bake the same breaks into new documents.

Unlike Microsoft Word, Docs does not use caret codes like ^p. Instead, the Find and Replace dialog understands regular expressions, which means one pattern can target every unwanted newline while leaving real paragraphs untouched. The official instructions live in Google's find and replace help article, and the sections below turn them into a repeatable cleanup workflow.

PDF
Paste Source

Pasted PDF Text

Academic papers, contracts, and reports keep their printed margin widths, dropping a hard return after every visual line when copied into Docs.

MAIL
Paste Source

Email & Chat Copy

Plain-text messages wrap near 72 characters and quote old replies line by line, so pasted threads inherit breaks from every sender in the chain.

LIST
Structure

Lists & Outlines

Numbered and bulleted items each live on their own line. Cleaning carelessly merges the list into one paragraph and destroys the structure you wanted.

CV
Documents

Resumes & Forms

Contact blocks, address lines, and form templates use deliberate breaks — you need to remove the ugly ones without flattening the intentional ones.

Method 1: Find & Replace Without Regex

The simplest route works when you just want every break gone. Open your document, press Ctrl + H on Windows or Cmd + H on Mac — or choose Edit → Find and replace — and follow these steps:

  1. In the Find field, type \n (backslash followed by n). This only matches when Match using regular expressions is ticked, so enable that checkbox first.
  2. In Replace with, type a single space. The Replace field is literal here — a space is inserted exactly as typed, which is exactly what you want.
  3. Press Replace all. Every line break in the document becomes a word space, and sentences rejoin into continuous paragraphs.
  4. Undo with Ctrl + Z if the pass merged paragraphs you wanted to keep — then move to the paragraph-safe method below.

This covers the most common complaint — a document where every line is its own paragraph. But a blanket replace also erases genuine paragraph boundaries, so for articles, reports, and anything with real structure you need the pattern discipline in the next section. The same caret-free logic applies when text moves into Microsoft Word later; our Word line break guide shows how that editor differs.

Method 2: Regex Patterns That Actually Work in Docs

Tick Match using regular expressions and the Find field becomes a pattern matcher. These are the patterns that matter for line break cleanup, in the order you should run them:

Google Docs Regex Pattern Reference

Copy-Paste Ready
← Scroll horizontally on smaller screens →
Find (regex)Replace withWhat it doesUse when
\n\n## (any placeholder)Parks real paragraph boundaries behind a tokenAlways step one of a paragraph-safe pass
\n(space)Replaces every remaining single line break with a spaceNormal prose cleanup
\n+(space)Collapses runs of two or more breaks in one actionDocuments with noisy blank rows
(?<!\n)\n(?!\n)(space)Removes only breaks not touching a blank line — paragraphs survive automaticallyOne-pass paragraph-safe cleanup
\t(empty)Deletes tab characters left by tables and pasted listsAfter newline cleanup, for spacing polish

The lookaround pattern in row four deserves attention: (?<!\n) refuses to match a break that follows another break, and (?!\n) refuses one that is followed by another. Blank-line paragraph boundaries therefore never qualify, while mid-sentence wraps always do. One Replace all call and the document is clean.

Three step Google Docs find and replace regex workflow to remove line breaks while keeping paragraphs
🔁Three-step workflow: open the dialog with Ctrl + H, tick Match using regular expressions, then run the pattern order — placeholder for \n\n, space for \n, restore the placeholder.

Method 3: The Paragraph-Safe Three-Pass Method

If lookaround syntax ever misbehaves in your browser, the classic placeholder sequence achieves the same result with three plain patterns. It is longer, but it is impossible to get wrong:

  1. Protect paragraphs: Find \n\n, replace with ##. Every blank-line boundary in the document is now a token you can see.
  2. Remove the wraps: Find \n, replace with a single space. All remaining single breaks disappear.
  3. Restore structure: Find ##, replace with \n\n. Real paragraphs return; the fake ones stay gone.

Pick a placeholder that cannot appear in your text — ## works for prose, but a token like @@PARA@@ is safer for markdown-heavy documents where hashtags are meaningful. Always run a quick Ctrl + F count of your placeholder before replacing, so you can confirm every one was restored.

Before and After in Google Docs

A typical paste, followed by the result of a paragraph-safe pass:

Pasted Into Docs
Project Atlas kicks off
in the first week of
November. The design
phase runs for three
sprints.

Budget approval is
needed from finance
before kickoff.
After Cleanup
Project Atlas kicks off in the first week of November. The design phase runs for three sprints.

Budget approval is needed from finance before kickoff.

The wraps after "in the first week of" and the other mid-sentence breaks are gone, while the blank line between the two paragraphs survives untouched. For the same operation on text that must stay outside Docs — form fields, CRM notes, spreadsheet cells — the Preserve Paragraphs tool applies identical logic in one paste.

What Google Docs Regex Can and Cannot Do

Knowing the boundaries of the feature saves an hour of debugging. Three hard limits matter:

  • The Replace field is literal. Regex works only on the Find side. Anything you type into Replace with is inserted as plain text — so $1 capture references do nothing in Docs. (Capture groups in replacements work in Google Sheets, not in Docs.)
  • No advanced find on mobile. The Android and iOS apps do not expose regex Find and Replace. Clean on desktop, or clean before you paste.
  • Engine differences are real. Google's own products document the RE2 engine for Sheets functions such as REGEXREPLACE, while the Docs dialog uses your browser's engine. Patterns using lookaround work in modern browsers, but if a pattern silently matches nothing, fall back to the three-pass placeholder method.

Also remember that regex formatting entered into the Replace field is treated as literal text by design — this is documented behavior, not a bug. For regex replacement features with capture groups, Google points users to Sheets functions; for Docs, order your passes so each one only needs literal replacement text.

Alternative Routes: Sheets, Word, and the Browser

Find and Replace is not the only path. Depending on where the text is headed, a different tool may be faster or safer:

Cleanup Route Comparison

Choose Your Path
← Scroll horizontally on smaller screens →
RouteSpeedParagraph Safe?Best For
Docs Find & Replace + regexUnder a minuteYes, with the placeholder or lookaround patternCleaning text that must stay in the Doc
Google Sheets REGEXREPLACEInstant per cellConfigure the pattern per columnBatch data, CSV-shaped content, form exports
Microsoft Word replaceUnder a minuteYes, with caret codesFiles that will be shared as .docx
Browser line break removerSecondsYes — built-in Preserve Paragraphs modeCleaning before paste, any destination

Sheets deserves special mention for tabular data: REGEXREPLACE(A2, "\n", " ") flattens a cell in one formula, and the Sheets function set is covered in our Excel and Google Sheets guide. If the content originated as a scanned PDF, clean the hyphens and margin returns first by following How to Clean Up Text Copied from a PDF, then finish the structure work here.

Automation: Repeat Cleanup with Apps Script

Editors who clean the same document pattern daily can automate the three-pass method. Google Apps Script exposes the document body through DocumentApp.getActiveDocument().getBody(), and its replaceText method accepts a regex pattern plus a literal replacement — performing both sides of the operation in a single call.

A practical script runs the same sequence you would run by hand: replace double newlines with a visible token, replace single newlines with spaces, then restore the token. Bind it to a custom menu item and the whole cleanup becomes one click for every future document. Apps Script is documented on the Google Developers site, and the pattern set is identical to the table above — only the delivery mechanism changes.

For one-off documents, automation is overkill — a single pass through Find and Replace takes less time than opening the script editor. Reach for Apps Script when the same broken input lands in your workspace every week: recurring newsletter copy, weekly reports, or template text imported from another system.

Pre-Cleanup Checklist

  • Decide what must survive. Paragraphs, lists, or address blocks — name the structure before you open the dialog, because the pattern choice depends entirely on it.
  • Always tick Match using regular expressions before typing a pattern; without the checkbox, \n is searched as a literal backslash-n.
  • Protect double newlines first — either with the placeholder pass or the lookaround pattern — before removing single breaks.
  • Read the result count. Replace all reports how many changes it made; zero matches means your pattern or checkbox is wrong, not that the document is clean.
  • Proofread the joins. Merged lines occasionally leave double spaces — one quick read catches every one.

Frequently Asked Questions

How do I remove line breaks in Google Docs without removing paragraphs?+
Open Find and Replace with Ctrl + H, tick Match using regular expressions, and either use the single pattern (?<!\n)\n(?!\n) replaced with a space, or run the three-pass sequence: \n\n to a placeholder, then \n to a space, then the placeholder back to \n\n. Both approaches keep real paragraph boundaries while dissolving mid-sentence wraps.
Why can't I use regex in the Replace with field?+
Google Docs inserts everything typed into Replace with as literal text — this is documented behavior. Capture-group syntax such as $1 works in Google Sheets functions, not in the Docs dialog. Structure your cleanup as ordered passes so each replacement only needs plain text.
How do I replace line breaks with a space in Google Docs?+
Press Ctrl + H, tick Match using regular expressions, enter \n in Find, type one space in Replace with, and click Replace all. Every line break in the document becomes a normal word space.
Can I do this in the Google Docs mobile app?+
No — the advanced Find and Replace options, including regular expressions, are unavailable in the Android and iOS apps. Clean the text on desktop first, or paste it through our browser-based remover before opening it on mobile.
Does Google Docs use RE2 or my browser's regex engine?+
Google documents RE2 for its Sheets regex functions. The Docs Find and Replace dialog runs on your browser's engine, which is why modern lookaround patterns work there. If a pattern behaves unexpectedly, the three-pass placeholder method is engine-independent and always safe.

Explore Related Tools & Tutorials

Skip the Dialog

Clean Line Breaks Before You Paste Into Docs

One paste, one click, paragraphs preserved — the fastest alternative to Find and Replace, running entirely in your browser.

Open Online Line Break Remover →