Text Replacer

Find and replace across a whole text, with case matching and regular expressions.

  • Runs in your browser
  • Free, no sign-up
Paste text and enter what to find

About the Text Replacer

The Text Replacer finds every occurrence of a word, a phrase or a pattern in your text and replaces it with something else. Paste the text, type what to find and what to put in its place, and the changed text appears next to the original as you type.

It works like the find and replace in a word processor, with a few extras. You can match case or ignore it, replace whole words only, change just the first match, or switch to regular expressions to rearrange dates, add text to the start of every line or remove whole patterns at once.

Quick fixes clean up common problems in one click: double spaces, spaces at line ends, tabs, empty lines, HTML tags and curly quotes. Everything runs in your browser, so your text never leaves your device.

How to use it

  1. Paste your textPaste into the Original text box or drop a text file onto it. Sample loads two short sentences to try.
  2. Enter what to findType a word, a phrase or a pattern in Find. Leave Replace with empty to delete every match.
  3. Set the optionsMatch case, Whole words only, Regular expression and Replace all matches change how matches are found. Replace all matches is on by default.
  4. Or pick a quick fixChoose one from Quick fixes to fill in a ready-made pattern for common clean-up jobs.
  5. Check and copyThe status line shows how many matches were replaced. Copy or download the result, or use it as input for another replacement.

Key features

Live preview

The result updates on every keystroke, and the status line counts the replacements.

Case and whole words

Ignore case by default or match it exactly. Whole words only leaves "category" alone when you replace "cat".

Regular expressions

Use JavaScript regular expressions with groups ($1, $2), and \n or \t in the replacement for line breaks and tabs.

Seven quick fixes

Extra spaces, spaces at line ends, tabs to four spaces, empty lines, HTML tags, curly quotes and curly apostrophes.

Safe with slow patterns

A pattern that would freeze the page is stopped after two seconds with a message instead.

Chain replacements

Use as input moves the result back to the left, so you can run several replacements one after another.

Examples

A simple replacement

The Sample button loads this text:

Our office opens at 9am. The office closes at 5pm.
Please call the OFFICE before visiting.
Find "office", replace with "studio"Result
Default settings3 matches replaced, including OFFICE
Match case on2 matches replaced, OFFICE stays
Replace all matches off1 match replaced, only the first "office"

Without Match case, the replacement is inserted exactly as you typed it, so "OFFICE" becomes "studio" in lowercase.

Whole words only

Replacing "cat" with "dog" in cat category concat cat. Cat changes 5 matches and gives "dog dogegory condog dog. dog". With Whole words only, it changes 3 and gives dog category concat dog. dog.

Rearranging dates with a regular expression

Turn on Regular expression, then find (\d{4})-(\d{2})-(\d{2}) and replace with $2/$3/$1:

BeforeAfter
Due 2026-10-06, paid 2026-11-15.Due 10/06/2026, paid 11/15/2026.

Each pair of parentheses captures part of the match, and $1, $2 and $3 put those parts back in a new order.

More regular expression jobs

FindReplace withResult
^- Adds "- " to the start of every line
, \nred, green, blue becomes three lines
(\d+)(am|pm)$1 $29am and 5pm becomes 9 am and 5 pm

Quick fixes

Quick fixBefore and after
Extra spaces to onetoo   many    spaces
too many spaces
HTML tags<p>Hello <strong>world</strong></p>
Hello world
Curly quotes to straight“Hello,” she said.
"Hello," she said.
Curly apostrophes to straightIt’s Jack’s ‘big’ day
It's Jack's 'big' day

Tips

  • Check the match count before you copy. If it is higher than you expected, turn on Whole words only or Match case and watch the number drop.
  • To delete something everywhere, such as a tracking code or a repeated disclaimer, leave Replace with empty.
  • Several changes in a row? Make the first one, click Use as input, then enter the next. Each step is easy to check on its own.
  • Regular expressions treat each line separately for ^ and $, so ^ means "start of a line" and $ means "end of a line" anywhere in the text.
  • Test a new pattern in the Regex Tester first. It highlights every match and shows the captured groups, which makes mistakes easier to spot.

Common mistakes and limits

  • Expecting the original capitals to be keptWith Match case off, every match is replaced with your text exactly as typed. Replacing "office" with "studio" also turns "Office" and "OFFICE" into "studio". Run separate replacements with Match case on if capitals matter.
  • Typing \n without Regular expressionOutside regular expression mode, \n is replaced literally as a backslash and an n. Turn on Regular expression to insert a line break.
  • Forgetting to escape special charactersIn regular expression mode, characters such as . ? * + ( ) [ ] and $ have special meanings. Find "3.5" also matches "305". Put a backslash before them, as in 3\.5, or turn regular expressions off.
  • Removing HTML tags to get clean textThe HTML tags quick fix removes the tags only. Entities such as &amp; stay as they are, and text inside script or style tags is kept. Use the HTML Decoder for the entities.
  • Writing a pattern that backtracks too muchPatterns with nested repeats, such as (a+)+$, can take forever on some text. The tool stops them after two seconds; rewrite the pattern without nested repeats.

Frequently asked questions

How do I find and replace text online?
Paste your text in the Original text box, type the word to find and the new word in Replace with. The changed text appears on the right, ready to copy, and the status line tells you how many matches were replaced.
Is the search case-sensitive?
Not by default. "office" also finds "Office" and "OFFICE". Turn on Match case to find only the exact capitalization you typed.
What does Whole words only do?
It only replaces matches that are not part of a longer word. Replacing "cat" then leaves "category" and "concat" alone but still changes "cat." and "Cat".
How do I use groups in the replacement?
Turn on Regular expression, wrap parts of the pattern in parentheses, and refer to them as $1, $2 and so on in Replace with. $& inserts the whole match. Outside regular expression mode, $ is inserted literally.
How do I replace text with a line break?
Turn on Regular expression and type \n in Replace with. Use \t for a tab. To remove line breaks instead, find \n and replace it with a space, or use the Remove Line Breaks tool.
Can I replace only the first match?
Yes. Turn off Replace all matches and only the first match in the text is changed.
What do the quick fixes do?
Each one fills in a ready-made regular expression: it squeezes repeated spaces, removes spaces and tabs at line ends, turns tabs into four spaces, deletes empty lines, strips HTML tags, or turns curly double quotes or curly apostrophes into straight ones.
Is my text saved or sent anywhere?
No. Find and replace runs entirely in your browser. Nothing is uploaded, and closing or reloading the page clears the text.