Remove Line Breaks From Cells in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
A line break inside a cell is the character CHAR(10). To remove it with a formula, replace it with a space or comma: =SUBSTITUTE(B2,CHAR(10),", "). To remove it in place, open Find and Replace with Ctrl+H, press Ctrl+J in the Find what box, type a space in Replace with and click Replace All.
Key takeaways
- A line break in a cell (Alt+Enter) is the line feed character, CHAR(10).
- =SUBSTITUTE(B2,CHAR(10)," ") swaps each break for a space and keeps the original data untouched.
- In Find and Replace on Windows, Ctrl+J types a line break into the Find what box.
- CLEAN deletes line breaks but joins the words together, so use SUBSTITUTE when you need a space.
- Data from some systems also has CHAR(13). Remove it with a second SUBSTITUTE, then tidy spaces with TRIM.
On this page+
- What is a line break in an Excel cell?
- Method 1: Remove line breaks with Find and Replace
- Method 2: Remove line breaks with SUBSTITUTE and CHAR(10)
- Method 3: Remove line breaks with CLEAN
- Why some line breaks won't go away (CHAR(13))
- How to check whether a cell has a line break
- Split the lines into columns instead
- Practise it
To remove line breaks in Excel, replace the hidden line break character, CHAR(10), with a space or a comma. You can do it with a formula, =SUBSTITUTE(B2,CHAR(10),", "), or in place with Find and Replace and the Ctrl+J trick. This guide shows both, plus CLEAN, the carriage-return problem that makes some breaks "stick", and how to split lines into columns instead.
All the examples use this address list in A1:B5. Each address has a line break inside the cell:
| A | B | |
|---|---|---|
| 1 | Customer | Address |
| 2 | Hill & Co | 12 Hill Road ↵ Leeds |
| 3 | Patel Ltd | 4 Mill Lane ↵ York ↵ YO1 7HH |
| 4 | Brook Cafe | 88 River Street ↵ Bath |
| 5 | Nova Labs | Unit 3, Park Way ↵ Oxford |
The ↵ marks where each line break sits. In Excel you see the text on separate lines when Wrap Text is on.
What is a line break in an Excel cell?#
A line break is a hidden character that starts a new line inside one cell. You add one by pressing Alt+Enter on Windows or Option+Return on a Mac (Control+Option+Return in some versions) while typing. Line breaks also arrive with data copied from websites, emails, forms and other systems.
Excel stores the break as the line feed character, which has the code 10. In formulas you write it as CHAR(10). Because it is a real character, it gets in the way: lookups fail to match, text is hard to sort, and exported CSV files can split one row into two.
Method 1: Remove line breaks with Find and Replace#
Find and Replace changes the cells themselves, so it suits a one-off clean-up. On Windows:
- Select the cells to clean, for example B2:B5.
- Press Ctrl+H to open Find and Replace.
- Click in Find what and press Ctrl+J. Nothing seems to appear, or you see a tiny blinking dot. That is the line break.
- In Replace with, type a space (or a comma and a space).
- Click Replace All.
If Excel says it found nothing, clear the Find what box completely and press Ctrl+J once more. Pressing it twice searches for two breaks in a row. On a Mac, the formula method below is the most dependable way to target CHAR(10).
Because this overwrites your data, keep a copy first. Undo works (Windows: Ctrl+Z; Mac: Cmd+Z), but only straight away.
Method 2: Remove line breaks with SUBSTITUTE and CHAR(10)#
SUBSTITUTE swaps one piece of text for another, and it can find CHAR(10) like any other character. In C2:
=SUBSTITUTE(B2,CHAR(10),", ")The result is 12 Hill Road, Leeds. Fill it down (Windows: Ctrl+D; Mac: Cmd+D) and row 3 becomes 4 Mill Lane, York, YO1 7HH, because SUBSTITUTE replaces every break in the cell, not just the first.
The three parts are: the text to clean (B2), what to find (CHAR(10)) and what to put instead (", "). Use " " for a plain space or "" to delete the break with nothing in its place. The SUBSTITUTE function guide covers the optional fourth argument, which replaces only one occurrence, and SUBSTITUTE vs REPLACE explains when to use each.
To replace the original column, copy the results, then paste them over column B as values (Windows: Ctrl+Alt+V; Mac: Ctrl+Cmd+V, then choose Values) and delete the helper column.
Method 3: Remove line breaks with CLEAN#
CLEAN removes non-printing characters, the first 32 codes in the character set, which include the line break. It is quick:
=CLEAN(B2)But look at the result: 12 Hill RoadLeeds. CLEAN deletes the break without adding a space, so the words run together. Use CLEAN when the breaks sit at the very end of the text, or alongside other junk characters. When the break separates words, SUBSTITUTE is the better choice.
Why some line breaks won't go away (CHAR(13))#
Data from some systems and older files uses two characters for each new line: a carriage return, CHAR(13), followed by a line feed, CHAR(10). If you remove only CHAR(10), the CHAR(13) stays behind. It can look like a stray space or an odd box. Remove both, then tidy the spacing with TRIM:
=TRIM(SUBSTITUTE(SUBSTITUTE(B2,CHAR(13),""),CHAR(10)," "))The inner SUBSTITUTE deletes the carriage returns. The outer one turns the line feeds into spaces. TRIM then removes any double spaces and spaces at the start or end. The TRIM function guide explains exactly what it removes, and the article on why TRIM doesn't always work covers characters it misses, like the non-breaking space CHAR(160). For a full clean-up routine, see how to clean messy data.
How to check whether a cell has a line break#
Before you clean a big column, check which cells are affected. This returns TRUE when B2 holds a line break:
=ISNUMBER(FIND(CHAR(10),B2))And this counts the lines in a cell. For the Patel Ltd address in B3 it returns 3:
=LEN(B3)-LEN(SUBSTITUTE(B3,CHAR(10),""))+1It works by comparing the length of the text with and without its breaks. The same trick counts any character, as shown in how to remove characters in Excel.
Split the lines into columns instead#
Sometimes the lines are useful: street, city and postcode. Rather than removing the breaks, split on them. In Microsoft 365 or Excel 2024:
=TEXTSPLIT(B3,CHAR(10))This spills 4 Mill Lane, York and YO1 7HH into three cells side by side. In older versions, use Data > Text to Columns, choose Delimited, tick Other and press Ctrl+J in its box.
After you remove the breaks, turn off Wrap Text on the Home tab if the rows still look tall, then double-click a row border to reset the height. For stray spaces left over, see how to remove spaces in Excel.
Practise it#
Practise cleaning text in a live spreadsheet: you'll use TRIM, SUBSTITUTE and CLEAN on messy data, and each formula is checked instantly. Then try the address exercise on this page to remove a line break yourself.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
The address in B2 is on two lines. In C2, use SUBSTITUTE with CHAR(10) to replace the line break with a comma and a space.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | One line | |||
| 2 | 12 Hill Road
Leeds | |||
| 3 | 4 Mill Lane
York
YO1 7HH | |||
| 4 | 88 River Street
Bath | |||
| 5 | Unit 3, Park Way
Oxford | |||
| 6 | ||||
| 7 | ||||
| 8 |
Tip: SUBSTITUTE needs the text, what to find and what to put instead: B2, then CHAR(10), then ", " in quotes.
Practise this in a lesson
Frequently asked questions
How do I remove line breaks in Excel?
Use =SUBSTITUTE(B2,CHAR(10)," ") to replace each line break with a space, then copy the results and paste them as values. Or select the cells, press Ctrl+H, press Ctrl+J in Find what, type a space in Replace with and click Replace All.
What is CHAR(10) in Excel?
CHAR(10) is the line feed character, the same character Excel adds when you press Alt+Enter inside a cell. You can use it in formulas to find, remove or add line breaks.
Why does Find and Replace not find the line break?
Make sure you pressed Ctrl+J in the Find what box, and that nothing else is in the box. Nothing appears on screen, or only a tiny blinking dot. If it still finds nothing, the break may be CHAR(13), which a formula can remove.
Does CLEAN remove line breaks?
Yes. CLEAN removes non-printing characters, including CHAR(10) and CHAR(13). But it deletes them without adding a space, so 12 Hill Road and Leeds become 12 Hill RoadLeeds.
How do I split a cell at the line breaks instead?
In Microsoft 365 or Excel 2024, use =TEXTSPLIT(B2,CHAR(10)) to spill each line into its own cell. In older versions, use Text to Columns with Other as the delimiter and press Ctrl+J in its box.