Find and Replace Line Breaks in Excel

When you want to create a line break (line feed) in a cell, you press Alt + Enter, to start a new line. You can put one or more line breaks in a cell, to make the contents easier to read. But how can you find and replace line breaks in Excel?

Find Line Breaks in Excel

Line breaks are easy to add, but a little trickier to remove.

To find specific text in Excel, you can use Ctrl + F to open the Find and Replace dialog box. However, if you try to type Alt + Enter in the Find What box, you’ll just hear a beep from your computer. Excel won’t let you put that shortcut into the Find What box.

Instead of using Alt + Enter, you can use a special shortcut to enter a line break in the Find What box:

Ctrl + J

Why does that work? A line break is character 10 in the ASCII character set, and the Ctrl + J shortcut is the ASCII control code for character 10.

Find and Replace a Line Break

To find a line break, and replace it with a space character, follow these steps. There is a video below, that shows the steps.

Select the cells that you want to search

On the keyboard, press Ctrl + H to open the Find and Replace dialog box, with the Replace tab active

Click in the Find What box

On the keyboard, press Ctrl + J to enter the line break character -- NOTE: No text will appear in the Find What box -- just a small blinking dot

Press the Tab key on the keyboard, to move to the Replace With box

Type a space character

Then, click Find Next or Find All, to find the cells with line breaks.

OR, click Replace or Replace All, to replace the line breaks with space characters.

NOTE: If these steps don't work, try the tips and troubleshooting suggestions below.

4. On the keyboard, press Ctrl + J to enter the line break
character — NOTE: Nothing will appear in the Find What box

Your “NOTE” is not entirely true… if you look carefully at the bottom left corner of the “Find what” field, you should see a small blinking “dot”… it is not a dot, rather, it is the top of the blinking text cursor on the line below (which Ctrl+J created) peeking through. If you press the left arrow, you will see the full text cursor because you have moved it to the other side of the Line Feed character placed by Ctrl+J… press the right arrow and the text cursor nearly disappears again as it move back to the other side of the Line Feed character again.

Forgive me, Leonardo, but in order to avoid misinterpretation of your comment, I will take it upon myself to correctly translate a very common mistake by native Spanish speakers. People who speak Spanish very often think that “any” means “no” or “none”.
The comment should read:

You solved me a huge curiosity and NO page on the subject helped me more than u!

By the way, I also want to thank you, Debra, for solving a long desired solution to this Alt+Enter dilemma, and Ctrl+J is good news to me too.

Does not work in my version of Excel 2010. I download a csv file from an Oracle table and convert it to Excel 2010. It contains a text field for which some have just the text and some the text and a carriage return or linefeed. I can clear those out using various, time consuming, methods such as copy and paste or =Clear(), but was hoping for a Find/Replace. I tried this as soon as I saw it. Sometimes I get the flashing dot when I type Ctrl+J, most times I don’t, and in neither case, does it find anything. Alt 0010 does not work either. Any ideas why it works for others but not for me? Am I possibly getting something besides a linefeed? Sure looks like one in the cell.
Thanks,
Biff

This is supposed to be quasi-standard of office software, and there is no obvious way to find information about this and many other little extras in the official documentation … MS must be kidding!

This is as annoying as the missing “export” option for document formats – why does MS Office always assume you want to “convert” and carry on editing in a different format, instead of just exporting to it ?? Mind-boggling!

Looking over some of the other comments, I noticed a few people were having trouble getting this to work. It was “on and off” for me too, until I realized that I was occasionally inserting more than one Ctrl J into the the Find box. Because it’s invisible, it’s easy to do. The Find/Replace dialog retains it’s characters during a session, so when you re-open it, the Ctrl J box looks empty, but it’s not. Once I realized this, it worked every time for me. Hopefully, this may be helpful to others having problems.

I have searched high and low to do something similar, but slightly different… I would like a formula to remove everything to the right of a line break in a cell… I know a line break is Chr(10), but can’t figure out how to incorporate that into the “=replace” formula. Any help would be hugely appreciated!

Sorry… I forgot to mention that once you insert the Ctrl+J character and the type the *, you will not see the asterisk either because it is below the viewing area of the Find field… you will only see the “blinking dot”. If you play with the arrow keys you will be able to follow the dot and know how many characters, if ever, you have typed after the Ctrl+J. That would be in case you want to replace or erase a specific string. Play with it… type several characters after the Ctrl+J and then move the cursor back and forth with the arrow keys.
Cheers

Hi DJS,
Have you tried inserting Ctrl+J and an asterisk in the find field?
When you insert a Ctrl+J in the Find field, you will notice a tiny blinking dot at the beginning of the field.
That is the cursor that has gone to the “next line” as it does in Excel when we insert an Alt+Enter. If you press the Left arrow you will see the cursor fully reappear in the field and the Right arrow will make it go back down.
Anyway, back to our scheduled program, simply insert a Ctrl+J followed by an *.
I type capital J for clarity, but you actually type a lower-case j.
I hope this helps.
Cheers

Any suggestions on doing the reverse? I need to replace a special character “|” with a line break. When I try this above mentioned method using the Replace All option, all the data in each cell is deleted where the “|” exists. Additional Note: I am selecting an entire column, but also tried it on an individual cell.

Incredible – the video really helped !!! I have a massive table in word with tonnes of line break that I was struggling to get into excel. I replace all line breaks by a text – my name – and then in excel I replaced my name to crtl+J

Hi,
I tried, Capital J to replace the line break and the formula and all tips and tricks from this conversation.
unfortunately, nothing turned out.
I am trying to replace a line break with a space in a column of my .CSV sheet.

I copied the column and paste into another blank sheet and saved it and tried again with all possible options. But couldn’t get the replacement. I can see that copy paste is the only option now to get my work done. But I don’t want to take a chance of losing the original data in replacing the cells when I filter them out during copy paste.

Before seeing “Ctrl+J” on this webpage, I was at a total loss.
I had an MSWord table containing forced line returns within cells and when copying the info to Excel it was putting the “next line” info, not into the same cell but into a new cell.

This (plus a couple of logical gyrations) will save me a couple of hours today and several hours in the future. . . PLUS it may appear that I know some “magic”. ; – )

Hi – I have line breaks (Ctrl+J) that I would like to replace with paragraph breaks (^p in Word).
Do you know how to do this in Excel?
I know you usually want to get rid of them in Excel, but I need them for my translation software to detect the end of a segment.
(At the moment I can export to Word or change the segment definition in the translation software, but changing the source Excel file would be the neater solution). Many thanks
Giles