Free online text tool

Remove Lines Containing A Certain Word

Remove Lines Containing A Certain Word deletes every line that contains the word or text you type. Paste your text, enter the word and copy the result. It is free and runs in your browser.

Remove Lines that Contain Certain Words Tool

0Character Count
0Character Count (without spaces)
0Word Count
0Sentence Count
0Paragraph Count
0Line Count

Line Removal Example

Before (remove lines containing Sam)
Michael ran slow.
Sam ran fast.
Greg won the race.
After
Michael ran slow.
Greg won the race.

Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.

Suggest a New ToolProvide Feedback on This Tool

What does Remove Lines Containing A Certain Word do?

This tool removes every line that contains the word or text you type and keeps all the other lines in their original order. A line is removed if the text appears anywhere in it.

The match works on any text, not only whole words, so sun also removes a line with sunny or sunset. By default capital letters do not matter. Tick Match case to match capitals exactly. Empty lines do not contain your text, so they stay.

Use it to take unwanted lines out of a log, a list of names, an export or any long text.

Remove lines containing a certain word examples

Each example shows the word used. Capitals are ignored unless Match case is on.

SettingBeforeAfter
Word: Sam
Michael ran slow.
Sam ran fast.
Greg won the race.
Michael ran slow.
Greg won the race.
Word: error
ok: saved
error: disk full
ok: sent
error: timeout
ok: saved
ok: sent
Not a whole word (sun)
sunny day
sunset
moon
moon
Match case off (default, cat)
Cat food
cat toy
dog bowl
dog bowl
Match case on (cat)
Cat food
cat toy
dog bowl
Cat food
dog bowl
Empty lines stay (a)
b1

a2
b3
b1

b3

How to remove lines containing a certain word

  1. 1
    Add your text
    Type or paste your lines into the box, or import a text file.
  2. 2
    Enter the word
    Type the word or text that the lines you want to remove contain. Tick Match case if capitals matter.
  3. 3
    Click Remove Lines
    Every line that contains your text is deleted. Use Undo if you change your mind.
  4. 4
    Copy it
    Click Copy and paste the result where you need it.

When to remove lines containing a word

Good for

Taking unwanted lines out of a log, a list of names or an export, and cleaning up a long text in one step.

Check first

The text matches inside words too, and spaces count, so cat also removes a line with category. Lines that match are deleted from the box. Use Undo right after if the result is not what you wanted.

Other tools

To keep the matching lines instead, try Keep Lines Containing A Certain Word. To get rid of blank lines, try Remove Empty Lines.

Remove lines containing a certain word FAQ

What does the Remove Lines Containing A Certain Word tool do?

It removes every line that contains the word or text you enter and keeps all the other lines in their original order.

How do I remove lines containing a certain word?

Type or paste your text, enter the word in the Remove lines that contain box and click Remove Lines. The result replaces the text in the box. Click Copy to use it, or Undo to go back.

Does it match whole words only?

No. It matches the text anywhere in a line, so sun also removes a line with sunny or sunset.

Does it care about capital letters?

Not by default, so Sun, SUN and sun all match. Tick Match case if you want capitals to match exactly.

Can I search for more than one word?

You can search for a phrase, such as red car, and a line is removed if it contains that exact text. It does not search for several different words at once.

What happens to empty lines?

They stay, because an empty line does not contain your text. To remove them use Remove Empty Lines.

What if no line contains my word?

The tool shows a message and leaves your text as it is, so nothing is changed by mistake.

Is this tool free and is my text private?

Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.

Looking for more text tools?

Browse Remove Tools

Last updated: 11 November 2026