← All how-to recipes

How to remove line breaks from a cell

✓ Verified in LibreOffice 25.8.7.3

Replace the newline characters inside a cell with spaces (or nothing) to flatten multi-line text.

The formula

AppFormulaNotes
Excel=SUBSTITUTE(A2,CHAR(10)," ")CHAR(10) is the line-feed; use CHAR(13) too for Windows carriage returns.
Google Sheets=SUBSTITUTE(A2,CHAR(10)," ")Identical.
LibreOffice Calc=SUBSTITUTE(A2,CHAR(10)," ")Identical.

How it works

CHAR(10) is the line-break character. SUBSTITUTE swaps every line break for a space, turning two-line text into one line: 'line1\nline2' becomes 'line1 line2'. Replace " " with "" to delete the breaks entirely.

Verified, not just documented

We ran =SUBSTITUTE(A2,CHAR(10)," ") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned line1 line2 — exactly the expected result. Every formula here is confirmed by actually executing it.