- Home
- Text tools
- Find and Replace
Find and Replace
Replace across a whole document at once, with optional regular expressions.
Find and replace text
Never uploadedYour file is processed in this tab and never sent anywhere.
The ads come from Google. Your files stay on your device.
How to find and replace text
- Paste your text. Or drop a text file onto the box.
- Enter what to find and replace. Turn on regex for patterns rather than literal text.
- Copy the result. With a count of how many replacements were made.
About Find and Replace
Find and replace exists in most editors, so the reason to use a separate tool is usually that you are between applications: text copied out of an email, a PDF, or a spreadsheet that needs cleaning before it goes somewhere else. Doing it in a browser tab avoids opening a word processor to make one substitution across four hundred lines.
The options do most of the real work. Case sensitivity matters when replacing an identifier that also appears as an ordinary word. Whole word matching prevents the classic disaster where replacing "cat" turns "category" into "egory": it requires a word boundary on both sides of the match. Both are off by default, which is the more forgiving behaviour, so turn them on deliberately when the replacement is precise.
Regular expressions turn this from a substitution tool into a pattern tool. With regex on, you can match anything with a shape rather than a fixed value: phone numbers, dates, email addresses, repeated whitespace, anything between two markers. Capture groups can be referenced in the replacement as $1, $2, and so on, which lets you reorder or restructure matches rather than just swapping them: turning dates from DD/MM/YYYY into YYYY-MM-DD, for instance.
The count of replacements is worth reading before you copy the result. It is the fastest way to catch a mistake: if you expected twelve replacements and it reports four hundred, your pattern is matching more than you intended, and the number tells you that before you paste the damage somewhere. Everything runs in this browser tab, so text you would rather not hand to a website stays on your device.
Useful regex patterns
| Pattern | Matches | Common use |
|---|---|---|
| \s+ | Any run of whitespace | Collapse multiple spaces into one |
| ^\s+|\s+$ | Leading or trailing whitespace | Trim every line |
| \d{4}-\d{2}-\d{2} | An ISO date | Find or reformat dates |
| [\w.]+@[\w.]+ | An email address | Redact or extract addresses |
| \n{3,} | Three or more line breaks | Collapse excessive blank lines |
| (\d+)/(\d+) | Two numbers with a slash | Reorder using $2/$1 |
Find and Replace FAQ
How do I replace whole words only?
Turn on whole word matching. Without it, replacing "cat" will also change the "cat" inside "category".
Can I use regular expressions?
Yes. Turn on regex mode and the find field is treated as a pattern. Capture groups can be referenced in the replacement as $1, $2, and so on.
How do I remove text rather than replace it?
Leave the replace field empty. Every match is deleted.
How do I know the replacement worked correctly?
The tool reports how many replacements were made. If that number is far from what you expected, your pattern is matching more or less than you intended.
Can I replace line breaks?
Yes, with regex mode on. Use \n for a line break, or \n{2,} for two or more.
Is my text uploaded?
No. The replacement runs in this browser tab.
Related tools
- Diff checker Compare two texts and see what changed.
- Remove duplicates Deduplicate a list, and sort it too.
- Case converter UPPER, lower, Title, camelCase, snake_case.
- Word counter Words, characters, and reading time.
- JSON formatter Format, minify, and validate JSON.
- PDF to Text Pull the words out as plain .txt.
