Free tool · Writing tools
Find and replace online
Paste your text, say what to find and what to put instead, and see the count, the matches highlighted and the replaced text. Plain search or JavaScript regular expressions, with guards so a bad pattern cannot freeze the page. Nothing you type leaves your device.
- Free
- No sign-up
- Runs in your browser
2 matches2 replaced
- plain text
- Ignore case
- Replace all
- Characters
- 91 before, 95 after
- Lines
- 3 before, 3 after
How to use the Find and Replace Text
- Paste your text into Your text, then type what to look for in Find and the new text in Replace with.
- Tick Match case, Whole words only or Regular expression if you need them, and choose All matches or First match only.
- Check the count and the Matches highlighted preview, which update as you type.
- Press Copy result to take the replaced text.
How do I replace many words at once, with case and whole-word options?
By default the search is plain text and ignores capital letters, so one search catches every spelling. In "Cat cat concat CAT.", replacing cat with dog gives "dog dog condog dog.": the first three hits change, including the one inside "concat". Tick Match case and only the exact spelling matches: "Cat dog condog CAT.". Tick Whole words only and "concat" is left alone: "dog dog concat dog.".
Whole-word matching treats letters, digits and the underscore as parts of a word, in any alphabet, so it also works on text with accents. First match only replaces just the first hit but still counts all of them, which is handy when you want to know how many are left: 4 matches in that sample.
In plain mode every character you type is taken literally. A dot, a plus, a bracket or a dollar sign has no special meaning, so searching for "1+1" finds exactly that. Only the Regular expression option gives characters special powers.
How do I use regex and capture groups ($1) in the replacement?
Tick Regular expression and the Find box is read as a JavaScript pattern. Brackets capture parts of the match, and the replacement can reuse them: $1 is the first group, $2 the second, $& the whole match and $<name> a named group. Turning "2026-11-19" into a day-first date uses the pattern (\d+)-(\d+)-(\d+) and the replacement $3/$2/$1, which gives "19/11/2026". Named groups make it readable: (?<f>\w+) (?<l>\w+) with $<l>, $<f> turns "john smith" into "smith, john".
The tool uses your browser's own JavaScript engine, so it follows that flavor: newer features such as lookbehind depend on your browser, and some syntax from other languages is not valid. The line anchors ^ and $ match at the start and end of every line, so ^ replaced with "> " quotes each line. If the pattern is not valid, you get the browser's own message instead of a result.
How do I replace line breaks and tabs?
Tick Read \n and \t as line break and tab. Then \n in Find means a line break and \t a tab, and the same codes in Replace with insert them. Replacing \n with a space turns a column of words into a single line: "one two three". In regular expression mode \n and \t already work in Find, but the option is still needed for the replacement. With the option off, a backslash is just a backslash, which matters for Windows paths.
Can a bad pattern freeze the page, and what are the limits?
A regular expression can take a very long time on some patterns, the classic case being a repeated group that already contains a repeat, such as (a+)+$. A browser cannot interrupt a pattern in the middle of a match, so the tool does three things. It refuses patterns of that nested shape with a message ("This pattern repeats a group that already contains a repeat, like (a+)+. Patterns shaped l..."). It limits regular expressions to 100,000 characters of text, and plain search to 1,000,000. And it checks the clock between matches and stops after 1.5 seconds with a message. Counting stops at 20,000 matches. These guards are safeguards, not a guarantee: a pattern the check does not recognize can still be slow, so keep patterns specific.
A few practical habits make replacements safer. Look at the count before you copy: if you expected five matches and see five hundred, a plain word is probably matching inside longer words, and Whole words only will fix it. Use First match only to test a pattern on one hit before you change them all. Keep the original text in the box until you are happy, because the result is shown beside it, not written over it. And when a regular expression is more than a few characters long, build it up step by step, watching the highlight preview grow with each added piece, so you can see exactly what each part matches.
The highlight preview shows the first 4,000 characters of your text, with the count and the replaced text covering all of it. For tidying results afterwards, the remove duplicate lines tool and the sort lines tool work on the same kind of pasted lists, and the word counter tells you how long the text is.
Use it with
- Remove Duplicate Lines: clean lists of repeated lines.
- Sort Lines Alphabetically: sort lists A–Z, Z–A, by length.
- Text Compare: show differences between two texts.
Questions
How do I replace many words at once?
Paste the text, type the word in Find and its replacement in Replace with. With All matches selected, every hit changes at once, and the count shows how many there were.
How do I use regex in find and replace?
Tick Regular expression. Find is then a JavaScript pattern, for example (\d+)-(\d+) to capture two numbers. Reuse the captured parts in the replacement as $1 and $2.
How do I replace line breaks or tabs?
Tick Read \n and \t as line break and tab, then use \n or \t in Find and in Replace with.
How do I do a case-sensitive or whole-word replace?
Tick Match case or Whole words only. With whole words, "cat" in "Cat cat concat CAT." leaves concat alone: 3 matches instead of 4.
How do I use capture groups ($1) in the replacement?
Turn on Regular expression and put the part to keep in brackets. Find (\d+)-(\d+)-(\d+) with replacement $3/$2/$1 turns 2026-11-19 into 19/11/2026.
Can a regular expression crash the page?
The tool refuses the classic freeze-prone shape, limits the text size and stops after 1.5 seconds. Those guards help but cannot catch every slow pattern.
How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.