Remove Line Breaks from Excel & Google Sheets Cells: The Complete Guide
Hidden line breaks inside spreadsheet cells wreak havoc on database imports, CSV exports, formula lookups, and reporting tables. Master every formula, Power Query transformation, VBA script, and shortcut to strip or replace line breaks in Excel and Google Sheets.

CHAR(10)) into unified, single-line data strings.Why In-Cell Line Breaks Cause Catastrophic Spreadsheet Errors
When entering data into Microsoft Excel or Google Sheets, users frequently press Alt + Enter (Windows) or Cmd + Option + Return (Mac) to format customer shipping addresses, delivery notes, product descriptions, or comments across multiple visual lines within a single cell.
While this makes the cell visually neat inside the spreadsheet grid, it injects invisible non-printable ASCII control characters—specifically ASCII character 10 (Line Feed, CHAR(10)) and ASCII character 13 (Carriage Return, CHAR(13))—directly into the underlying data string.
When this sheet is later used downstream in business pipelines, those hidden breaks cause severe technical glitches that cost data analysts, accountants, and CRM administrators countless hours:
- Corrupted CSV Exports: When exporting to a Comma-Separated Values (CSV) file, the in-cell line feed is interpreted by database parsers (PostgreSQL, MySQL, BigQuery, Snowflake) as the termination of an entire row. Columns get offset, numerical figures shift into name columns, and batch imports fail with schema mismatch errors.
- Broken VLOOKUP, XLOOKUP & INDEX/MATCH Matches: A cell containing
"Product 101"will not match a cell containing"Product 101\n"because the invisible character 10 fails exact equality tests. You will see maddening#N/Aerrors even when the strings appear identical on your screen. - Accidental Quotes When Copying: Copying a cell containing a line break and pasting it into an email, CRM record, or web form wraps the entire text block in unwanted double quotation marks (e.g.,
"123 Main St, Suite 400"). - Distorted Table Formatting and Erratic Row Heights: Spreadsheets automatically expand row height to accommodate multi-line cells, making tables uneven, clumsy to print, and frustrating to scan.
- Failed Text-to-Columns Splitting: When using Excel's Text-to-Columns wizard, unexpected line feeds cause delimiter misalignment, spilling fragmented values into adjacent calculation columns.
Shortcut Matrix: Line Breaks in Excel vs. Google Sheets
Keyboard shortcuts and behavior differ across operating systems and spreadsheet platforms. Keep this quick cheat sheet handy:
| Operation | Excel (Windows) | Excel (Mac) | Google Sheets (Windows) | Google Sheets (Mac) |
|---|---|---|---|---|
| Insert In-Cell Break | Alt + Enter | Cmd + Option + Return | Ctrl + Enter or Alt + Enter | Cmd + Enter |
| Find Line Break Box | Ctrl + J in Find box | Ctrl + Option + Return | \n (Regex checked) | \n (Regex checked) |
| ASCII Code Stored | CHAR(10) [LF] | CHAR(13) or CHAR(10) | CHAR(10) [LF] | CHAR(10) [LF] |
| Wrap Text Toggle | Alt + H + W | Ribbon > Wrap Text | Format > Wrapping | Format > Wrapping |
Method 1: Formula Approaches (CLEAN vs SUBSTITUTE vs REGEX)
If you have a large dataset and need to keep your source data untouched while generating clean output columns, formulas are the safest method.
The Native CLEAN Function (Warning: Merges Words)
Both Excel and Google Sheets offer the built-in CLEAN function, engineered to strip ASCII characters 0 through 31:
The Major Flaw: CLEAN deletes the control character entirely without inserting a replacement space. As a result, an address like:
Suite 400 New York
Suite 400New York
Because "400" and "New" collide without a space, CLEAN alone is rarely acceptable for human-readable text!
SUBSTITUTE with CHAR(10) (The Gold Standard Formula)
To replace the line break with a single space and remove any resulting double spaces, combine the SUBSTITUTE function with CHAR(10) and TRIM:
How This Formula Works:
- The inner
SUBSTITUTE(A2, CHAR(10), " ")converts every Unix/Windows Line Feed into a space. - The outer
SUBSTITUTE(..., CHAR(13), " ")converts any legacy Mac Carriage Returns into a space. - The surrounding
TRIM(...)eliminates accidental double spaces and trims leading/trailing whitespace.
Google Sheets Native REGEXREPLACE
If you are working in Google Sheets, you have access to powerful regular expression functions per Google Docs Editors Support:
This replaces one or more consecutive newline or carriage return characters with a single space in one clean step.
Spreadsheet Formula Comparison & Capability Guide
Review the differences across the formula techniques available in Excel and Google Sheets:
| Formula Pattern | Excel Support | Sheets Support | Replaces with Space | Handles CR + LF | Best For |
|---|---|---|---|---|---|
=TRIM(SUBSTITUTE(A2, CHAR(10), " ")) | Universal | Universal | Yes | LF only | Most standard Excel spreadsheets |
=TRIM(SUBSTITUTE(SUBSTITUTE(A2,CHAR(10)," "),CHAR(13)," ")) | Universal | Universal | Yes | Both | Cross-platform files (Mac & PC) |
=CLEAN(A2) | Universal | Universal | No (Deletes) | Both | Stripping non-text control symbols |
=TRIM(REGEXREPLACE(A2, "\n", " ")) | Excel 365 only | Universal | Yes | With regex | Google Sheets bulk operations |
Method 2: In-Place Cleanup Using Find & Replace (Ctrl + J)
If you want to modify your existing cells directly without creating extra formula helper columns, you can use Excel's secret keyboard shortcut inside Find & Replace:
- Select the range or column of cells you wish to clean.
- Press Ctrl + H to open the Find and Replace dialog box.
- Click into the Find what box. Press and hold Ctrl and tap J (Ctrl + J).
Note: The input box will appear empty or show a tiny blinking dot. This is normal! Ctrl + J inserts the non-printable character 10. - Click into the Replace with box and press the spacebar once to insert a single space.
- Click Replace All.
Method 3: Enterprise Scale with Power Query (Get & Transform)
When managing tens of thousands of rows imported from SAP, Salesforce, or Oracle databases, manually typing formulas or running Ctrl+J on every monthly export is inefficient. Microsoft Excel's built-in Power Query engine provides a fully automated, repeatable solution:
- Select your data table and navigate to the Data ribbon tab. Click From Sheet / Table to launch the Power Query Editor.
- Select the columns containing multi-line text (hold Ctrl to select multiple columns).
- Right-click the column header and select Transform > Clean. This automatically executes the M-code
Text.Clean()to strip non-printable line breaks. - To replace line breaks with spaces instead of deleting them, go to Transform > Replace Values. Click Advanced options, check Replace using special characters, select Line feed, and replace with a space.
- Click Close & Load. Power Query will output a clean, formatted table. Whenever new data arrives next month, simply click Refresh and your data cleans itself automatically!
Method 4: Developer Automation (Excel VBA & Google Apps Script)
For spreadsheet developers building automated dashboards, here are copy-paste automation scripts for both platforms:
Excel VBA: Clean Selected Range
Google Sheets Apps Script: Clean Active Sheet
Method 5: Cleaning Copied Spreadsheet Text in One Click Online
When copying data out of Excel or Google Sheets to paste into an email, CMS editor, or ticketing system, you often don't have time to write formulas or remember secret shortcut codes like Ctrl + J.
Simply copy your column, open our Replace Line Breaks with Space Tool, paste your text, and click once. The tool:
- Converts all spreadsheet row returns and cell breaks into single clean spaces.
- Collapses tabs, non-breaking spaces, and duplicate whitespace.
- Executes 100% locally in your browser for absolute privacy of confidential financial and customer records.
Frequently Asked Questions
Why do cells still show multiple lines after removing breaks?
How do I remove line breaks from an entire column in Google Sheets?
=ARRAYFORMULA(IF(A2:A="", "", TRIM(REGEXREPLACE(A2:A, "\n", " ")))).Why does copying a cell add quotes (" ") when pasting outside Excel?
Related Spreadsheet & Text Guides
Replace Line Breaks with Space →
Convert multi-line cell exports into a single clean line separated by spaces.
AdvancedBatch Remove Line Breaks from Multiple Documents →
Clean hundreds of data records or spreadsheet exports at once.
GuideClean Names, Addresses & Form Fields →
Field-level cleanup: detect hidden breaks, flatten safely, keep address blocks.