Find and Replace
Swap a word or a pattern across your whole text in one go, with a live count of replacements and regex support.
How to replace a word everywhere in a long text
Word processors have find and replace, but not every place you write text does. If you are editing an article in a plain text box, cleaning a data export, fixing a transcript or updating a template, this tool does the same job in a browser tab. Paste, type the old word and the new word, and every occurrence is changed at once, with a count of how many were replaced so you can check it makes sense.
Because the replacement happens in a separate output box, your original text is never overwritten. If the result is not what you expected, change the settings and the output refreshes, or simply keep the original and try again.
Making a bulk replacement safely
- Put your text in the left box. Your original is never overwritten, because the result appears separately on the right.
- Type what you are looking for in the Find box and what should replace it in Replace with. Leave the second one empty to delete every match.
- Adjust the options. Match case makes “Cat” and “cat” different, Whole words only skips matches that are part of a longer word, and Use regular expression switches the Find box to pattern mode.
- The result and the number of replacements appear straight away. Copy the result or use it as the new input if you want to chain several replacements.
Match case and whole words: avoiding accidental replacements
The classic find-and-replace mistake is changing more than you meant to. If you replace “cat” with “dog”, you will also turn “category” into “dogegory” and “scatter” into “sdogter”. Tick Whole words only and the tool only replaces “cat” where it stands on its own, with spaces or punctuation around it.
Match case works the same way for capitals. With it off, “Apple”, “apple” and “APPLE” are all found. With it on, only the exact capitalisation you typed is found. Turn it on when you need to change a product name but not the fruit.
When you are not using regular expressions, characters like ., *, ( and ? are treated as plain text, so you can safely search for things such as “version 2.0” or “(draft)” without any escaping.
Replace line breaks, tabs and spaces
You can type \n in either box to mean a line break and \t for a tab. That opens up some handy jobs:
- Turn a comma-separated line into a list: find
,and replace with\n. - Put every word on its own line: find a single space and replace with
\n. - Convert a list into one line: find
\nand replace with a comma and space. - Swap tabs for spaces: find
\tand replace with four spaces.
For ordinary joining of broken lines, the line break remover has more options and is quicker.
A beginner-friendly guide to regular expressions
A regular expression, or regex, is a pattern that can match many different pieces of text at once. Tick Use regular expression and the Find box accepts patterns. You do not need to learn all of it. These few go a long way:
| Pattern | Matches | Example use |
|---|---|---|
\d+ | Any number of digits | Delete or mask all numbers |
\s+ | Any run of whitespace | Replace with one space to tidy text |
^\s+|\s+$ | Spaces at the start or end of a line | Trim every line |
^ | The start of each line | Replace with - to add bullets |
colou?r | “color” or “colour” | Match both spellings |
(\w+)@(\w+) | Two parts around an @ sign | Use $2 and $1 to swap them |
In the replacement box, $1, $2 and so on insert the parts of the match captured by brackets in your pattern. $& inserts the whole match. If your pattern has a mistake, the tool shows the error message from your browser rather than failing silently.
The ^ and $ anchors work line by line, so you can add or remove something at the start or end of every line in one go. For instance, find ^ and replace with " to put a quote at the start of every line.
Common find and replace jobs
- Updating a company, product or person’s name across a long document.
- Replacing curly quotes with straight ones before pasting into code.
- Removing a repeated phrase, like a footer added to every paragraph.
- Fixing the same typo that appears dozens of times.
- Reformatting dates, for example swapping
(\d+)/(\d+)/(\d+)into$3-$2-$1. - Changing the separator in exported data from tabs to commas.
Find and replace troubleshooting
How do I replace all occurrences of a word in text?
Paste your text, type the word into Find and the new word into Replace with. Every match is replaced at once and the number of replacements is shown below the result.
How do I delete a word everywhere?
Type the word into Find and leave Replace with empty. Each match is removed. You may want to run the extra space remover afterwards to tidy any double spaces left behind.
Why did it replace part of another word?
Because Whole words only was off. Turn it on so “cat” does not match inside “category”.
How do I add a line break in the replacement?
Type \n in the Replace with box. It is inserted as a real line break in the result.
What does an invalid regular expression message mean?
The pattern in the Find box is not valid, for example an unclosed bracket. Fix it or untick the regex option to search for the text literally.
Is it case sensitive?
Not by default. Tick Match case if capital letters must match exactly.
Can I paste a confidential document to run replacements on it?
Yes. The matching and replacing is done by your browser, so the document is never transmitted. The only thing to watch is what you copy out afterwards.
Related text clean-up tools
Some replacements have a dedicated tool that is quicker: line break remover for line breaks, extra space remover for spacing, and case converter for capitalisation. When you are not sure the result is right, paste both versions into text compare and read the highlighted changes.