Find and replace text online, with live highlights
The Find and Replace tool swaps words, phrases or patterns throughout any text in one go. Type what to find and what to put in its place, and every match is highlighted in your text while the finished result appears underneath — no need to step through matches one at a time.
It goes beyond a basic replace box. Match case or ignore it, match whole words only, switch on regular expressions with capture groups such as $1, replace just the first match, and chain several find-and-replace rules that run in order. It is ideal for cleaning exported data, fixing a misspelled name across a long document, converting British to American spelling, or reformatting dates and codes. All processing happens in your browser, so confidential documents never leave your device.
How to use the Find and Replace
- Paste your text into “Your text”.
- In Rule 1, type the text to find and what to replace it with. Leave “Replace with” empty to delete every match.
- Tick the options you need: Case-sensitive, Whole words only, or Regular expression for pattern matching.
- Check the highlighted matches and the count next to each rule. Choose “Replace first only” if you want to change just the first match.
- Press “Add another rule” for more replacements; they run top to bottom. Then copy or download the result.
Find and Replace features
Live highlighting
Every match is highlighted in your original text as you type, in a different colour for each rule, with an exact count.
Whole-word matching
Replace “cat” without touching “category” or “concatenate”. It works with accented and non-English letters too.
Regular expressions
Use JavaScript regex syntax with capture groups ($1, $<name>), anchors, character classes and \n or \t in the replacement.
Multiple rules
Up to 20 find → replace pairs applied in order — perfect for repeatable clean-up jobs.
Clear error messages
An invalid pattern is flagged with the reason and a hint, and the rest of your rules keep working.
Safe preview
Your text is always shown as plain text, never interpreted as HTML, so pasting markup is safe.
Regular expression cheat sheet
Tick “Regular expression” to use patterns. A few that solve everyday jobs:
| Find | Replace with | What it does |
|---|---|---|
\s{2,} | a single space | Collapses runs of spaces and tabs |
^ | > | Adds “> ” to the start of every line (quote an email) |
(\d{2})/(\d{2})/(\d{4}) | $3-$2-$1 | Turns 14/03/2025 into 2025-03-14 (ISO 8601) |
(\w+)@(\w+)\.com | $1 at $2 | Rewrites email addresses |
,\s* | \n | Puts each comma-separated item on its own line |
\bcolou?r\b | colour | Matches both spellings of a word |
How the options work together
Case-sensitive off means “Apple”, “apple” and “APPLE” all match. Whole words only requires the match to stand alone, with no letter, digit or underscore immediately before or after it. Without “Regular expression” ticked, everything you type is matched literally — a dot is just a dot and $5 in the replacement is inserted exactly as typed.
With “Regular expression” ticked, “^ and $ match each line” makes the anchors work per line rather than for the whole text. Replace first only changes the first match of each rule and leaves the rest, which is handy for headings or the first mention of a name. When you use several rules, each runs on the output of the one before, so the order matters: replacing “a” with “b” and then “b” with “c” turns every “a” into “c”.
Common clean-up jobs
- Convert British to American spelling: add rules such as colour → color, favourite → favorite and organise → organize.
- Tidy pasted text by collapsing double spaces — or use Remove Extra Spaces, which also fixes tabs, non-breaking spaces and blank lines.
- Join lines or split them: replace
\nwith a space, or a separator with\n. For PDF text, Remove Line Breaks also repairs hyphenated words. - Build and debug a complex pattern first in the Regex Tester, then paste it here to apply it.
Find and Replace FAQ
How do I find and replace text online?
Paste your text, type the word to find and its replacement in Rule 1, and the result appears instantly with every match highlighted. Press “Copy result” or “Download .txt” when you are done.
How do I replace a word but not when it is part of another word?
Tick “Whole words only”. Replacing “cat” then changes “cat” and “Cat” but leaves “category” and “concatenate” alone.
How do I use capture groups like $1?
Tick “Regular expression”, wrap parts of the pattern in parentheses and refer to them in the replacement as $1, $2 and so on. For example, find (\w+), (\w+) and replace with $2 $1 to turn “Smith, Anna” into “Anna Smith”. Use $& for the whole match and $$ for a literal dollar sign.
How do I find and replace line breaks?
Tick “Regular expression” and use \n in the Find box to match a line break, or in the Replace box to insert one. For example, find \n and replace with a comma and a space to join lines into a list.
Why does my regular expression show an error?
The pattern is not valid JavaScript regex — usually an unclosed bracket or a special character such as ( [ . * + ? that needs a backslash in front of it to be matched literally. The message names the problem, and your other rules still run.
Is it safe to paste confidential text?
Yes. Find and replace runs entirely in your browser; your text is never uploaded, logged or stored.