Skip to content

Filter lines containing text

Keep only the lines you need, or remove the ones you don't, from lists, logs and CSV files. Match by text, start, end, exact line or regular expression.

  • Free, no limits
  • No sign-up
Everything happens in your browser; your data is never uploaded.
  • ✓ Free
  • ✓ No sign-up
  • ✓ Nothing uploaded

Next step

What to do next

How to use it

  1. Paste your lines or open a file.
  2. Choose Keep only these or Remove these.
  3. Pick a condition and type what to look for.
  4. Copy or download the filtered lines.
Try it now

Conditions

ConditionMatches lines that…
Containsinclude the text anywhere
Starts withbegin with the text
Ends withend with the text
Exact lineare exactly the text, nothing more
Regular expressionmatch a JavaScript regex pattern

Then choose what to do with the matches: Keep only these (like grep) or Remove these (like grep -v).

The note under the result shows how many lines matched and how many were kept.

Options

  • Multiple terms separated by commas (any). Type gmail, yahoo, outlook to match lines containing any of the three. Semicolons and pipes work as separators too. Not available in regex mode, where you'd write gmail|yahoo|outlook instead.
  • Ignore case. On by default, so gmail also matches GMAIL.com.
  • Whole words only (Contains mode). cat matches the cat sat but not category.
  • Remove empty lines. Blank lines are dropped from the result.

With regular expressions, case sensitivity follows the Ignore case option, and the pattern is tested against each line separately, so ^ and $ mean the start and end of the line.

Examples

GoalSettings
Only Gmail addresses from a listKeep · Contains · gmail
Drop comment lines from a config fileRemove · Starts with · #
Lines that start with a numberKeep · Regex · ^\d+
Error lines from a logKeep · Contains · ERROR, FATAL with multiple terms
Remove .png and .gif files from a file listRemove · Ends with · .png, .gif with multiple terms
Lines with a US ZIP codeKeep · Regex · \b\d{5}(-\d{4})?\b

Text you filter stays in your browser, so it's safe to use with server logs, customer lists and other private data.

Step-by-step: pulling errors from a log

  1. Open the log file with Open file, or paste the lines.
  2. Choose Keep only these and Contains.
  3. Turn on Multiple terms and type ERROR, WARN.
  4. Click Use result as input.
  5. Switch to Remove these and type healthcheck to drop noisy lines.
  6. Download the result.

The note after each step tells you how many lines matched, so you can see the effect of every filter.

Combine with other tools

Filtering is often one step in a cleanup:

  1. Remove extra spaces so stray spaces don't break starts with and ends with matches.
  2. Filter the lines here.
  3. Remove duplicate lines and sort lines in the result.
  4. Count the lines or join them into one line with the comma separator.

To change text inside lines instead of keeping or dropping whole lines, use find and replace. Use Use result as input to apply a second filter on top of the first, for example keep lines with ERROR, then remove lines with timeout.

Files

Click Open file to load .txt, .csv, .log or .md files and Download to save the result. Very large logs (several megabytes) work too, because the filtering runs locally.

Frequently asked questions

How do I remove lines that contain a word?

Choose “Remove these”, set the condition to Contains, and type the word.

How do I keep only lines that contain certain text?

Choose “Keep only these” with Contains and type the text. Use the multiple terms option to match any of several words.

Can I use regular expressions?

Yes. Choose Regular expression; the pattern is tested against each line, and Ignore case applies.

Is the filter case-sensitive?

Not by default. Turn off “Ignore case” for case-sensitive matching.

Can I filter a large log file?

Yes. Open the file or paste it; filtering runs in your browser, even for large files.

Last updated: November 12, 2026

Recommended

Similar tools

If Filter lines helped, you may need these too.

See all in category →

People also use