Find and Replace Text

Find a word, a phrase or a character in your text and replace every match in one step. Match case, match whole words only, or use regular expressions, then click any highlighted change to keep the original there. Leave the replacement empty to delete the matches.

  • Whole words
  • Regular expressions
  • Stays on your device
0 words · 0 characters
Result 0 words · 0 characters

Every match is replaced. Click a highlighted change to keep the original there.

Stays on this device
Matches
0
Replaced
0
Kept as they were
0
Characters after
0

How to find and replace text online

Replace words in text, documents or lists in three steps.

  1. Paste your text

    A document, an email, code or a list. You can also open a .txt, .csv or .md file.

  2. Type what to find and what to replace it with

    Every match is replaced straight away and highlighted in the result. Tick Match case, Whole words only or Regular expression to narrow the search.

  3. Check and copy

    Click a highlighted change to keep the original there, or use Previous and Next to step through them. Then copy or download the result.

Example

Replacing cat with dog in The cat sat on the mat. The category of cats: cat, Cat, CAT. finds 6 matches, including the “cat” in category and cats. Tick Whole words only and it finds 4.

Try it on a sample

Find and replace features

A full find and replace, with a preview of every change.

  • Aa

    Match case

    Replace only matches with the same capitals, or every match whatever its case.

  • \b

    Whole words only

    Replace cat without touching category or cats.

  • .*

    Regular expressions

    Patterns like \d+ and (\w+) with $1 and $2 in the replacement.

  • ✓

    Undo one change

    Click any highlighted change to keep the original there, or keep all and replace them again.

Match case and whole words

Finding *cat* and replacing it with *dog* in *The cat sat on the mat. The category of cats: cat, Cat, CAT.*:

OptionsMatchesResult
None6The dog sat on the mat. The dogegory of dogs: dog, dog, dog.
Match case4The dog sat on the mat. The dogegory of dogs: dog, Cat, CAT.
Whole words only4The dog sat on the mat. The category of cats: dog, dog, dog.
Match case and whole words only2The dog sat on the mat. The category of cats: dog, Cat, CAT.

Whole words only stops a match inside a longer word: “cat” in “category” and “cats” is left alone.

Regular expressions for find and replace

Tick **Regular expression** to do a regex replace online with a pattern. Some patterns that are useful in everyday text:

FindReplace withBeforeAfter
\d+#Order 66 shipped on 12 May, 3 boxes.Order # shipped on # May, # boxes.
\s+(one space)too many spacestoo many spaces
(\w+), (\w+)$2 $1Smith, JohnJohn Smith
(\d{4})-(\d{2})-(\d{2})$3/$2/$12026-11-2121/11/2026
^- apple⏎banana- apple⏎- banana
[\w.+-]+@[\w-]+\.[\w.]+[email]Write to anna@example.comWrite to [email]

$1 and $2 put back what the first and second brackets matched, and $& the whole match. ^ and $ mean the start and end of each line. ⏎ marks a line break.

Delete words, line breaks and special characters

  • Delete words: leave Replace with empty. Every match is removed; deleted matches show crossed out in the result.
  • Line breaks and tabs: type \n for a line break and \t for a tab, in either box. Find , * and replace it with \n to turn *red, green, blue into a list of one color per line, or the other way round.
  • Punctuation and symbols: plain searches find characters like ?, ( or $ as they are. In a regular expression, put a backslash before them: \?, \( or \$.

To remove every line break or every extra space at once, the Remove Line Breaks and Remove Extra Spaces tools have more options.

Find and replace shortcuts in other apps

The same job in the apps you already use:

AppShortcutLine breaks and special characters
Microsoft WordCtrl+H^p for a paragraph mark, ^l for a line break, ^t for a tab
Google DocsCtrl+H (Cmd+Shift+H on a Mac)Paste the text here to replace line breaks
Microsoft ExcelCtrl+HCtrl+J in Find what for a line break inside a cell

This tool works the same on any device, including phones, where most apps have no shortcut.

Check every replacement before you copy

A bulk replace text tool is quick, but a replace-all can change words you didn’t mean to change, like cat inside category. Every replacement here is highlighted in the result. Click one to keep the original word there; click it again to replace it after all. Previous and Next step through the matches, and Keep all originals or Replace all reset them in one go.

The counts under the tool show how many matches were found, how many were replaced and how many you kept, so you know the result before you paste it anywhere. To count how often a word appears without changing anything, use the Specific Word Counter.

Find and replace FAQ

How do I find and replace text online?

Paste your text, type the word to find and its replacement. Every match is replaced at once; copy the result.

Can I replace only one occurrence?

Yes. Every match is replaced first; click the highlighted changes you want to undo, or press Keep all originals and click the ones you want replaced.

Is find and replace case-sensitive?

No, not by default: cat finds cat, Cat and CAT. Tick Match case to find only the exact capitals.

How do I find and replace a whole word without changing other words?

Tick Whole words only. cat then matches the word cat but not category or cats.

Can I delete words with find and replace?

Yes. Leave Replace with empty and every match is deleted.

Can I replace line breaks?

Yes. Type \n for a line break and \t for a tab in either box.

Does it support regular expressions?

Yes. Tick Regular expression to use patterns like \d+ or ^, and $1, $2 and $& in the replacement.

Does it keep my line breaks and formatting?

Line breaks and spaces are kept exactly. The tool works on plain text, so bold, links and other formatting from a document are not kept.

Is my text uploaded?

No. Everything runs in your browser and nothing is sent or stored.

Sources and references

  1. Keyboard shortcuts for Google Docs, Google Docs Editors Help
  2. Helpful search strings for finding special characters in Word, Microsoft TechNet
  3. Regular expressions, MDN Web Docs