Free Find and Replace Text

Paste any text, type what to find and what to replace it with, and get the rewritten result instantly β€” with case-insensitive, whole-word, and regular-expression modes and a count of how many replacements were made.

2 replacements

Replacement runs with the JavaScript engine in your browser, so nothing is uploaded. In regex mode you can use groups like $1 in the replacement. Whole-word matching uses word boundaries (\b).

Quick answer

To find and replace text, paste your content, enter the search term and the replacement, then choose options like case-insensitive, whole-word, or regex. The tool scans the text with the JavaScript string/RegExp engine in your browser, replaces every match globally, and shows the new text plus how many replacements were made.

Formula & method

Replacement rule

output = text with every match of find replaced by replace (global)
  • text β€” the original content you paste
  • find β€” the search term, treated as literal text or as a regex pattern
  • replace β€” the string that each match is rewritten to (empty string deletes matches)
  • output β€” the resulting text after all replacements

Equivalent to JavaScript text.replace(/find/g, replace) with the chosen flags.

Match flags

flags = "g" + (case-insensitive ? "i" : ""); whole-word wraps the pattern as \b pattern \b
  • g β€” global β€” replace all occurrences, not just the first
  • i β€” ignore case when matching
  • \b β€” word boundary, so only standalone words match

The tool turns your "find" term into a global regular expression and runs it over the text. In literal mode, special regex characters in your search term (such as . * ? ( ) [ ]) are escaped so they are matched as plain characters. In regex mode, your term is used as the pattern itself, so you can match digits with \d+, groups, alternation, and more, and reference captured groups like $1 in the replacement. The "case-insensitive" option adds the i flag so MATCH, Match, and match are all found. The "whole word only" option wraps the pattern in word boundaries (\b…\b) so "cat" no longer matches inside "category" or "catalog". Matching is always global (the g flag), so every occurrence is replaced in one pass, and the tool reports the total number of replacements. All processing is synchronous and happens locally in your browser β€” nothing is uploaded.

Examples

Example 1: Replace a word everywhere
Input
Text: "The cat sat on the mat. The cat purred." β€” Find: cat, Replace: dog
Result
The dog sat on the mat. The dog purred. (2 replacements)
Why
Literal, case-sensitive, global replace swaps both occurrences of "cat" for "dog". "mat" is untouched because it is a different word.
Example 2: Case-insensitive match
Input
Text: "Color colour Color" β€” Find: Color, Replace: X, with Case-insensitive on
Result
X colour X (2 replacements)
Why
With the i flag, both "Color" tokens match regardless of capitalization. "colour" is spelled differently, so it does not match and stays as-is.
Example 3: Whole word only
Input
Text: "cat category catalog cat" β€” Find: cat, Replace: dog, with Whole word only on
Result
dog category catalog dog (2 replacements)
Why
Word boundaries (\bcat\b) match only the standalone "cat" tokens, so "category" and "catalog" are left unchanged.
Example 4: Regex to replace all numbers
Input
Text: "Order 12, item 3, total 45" β€” Find: \d+, Replace: #, with Regular expression on
Result
Order #, item #, total # (3 replacements)
Why
In regex mode \d+ matches each run of digits, so all three numbers are replaced with #.
Example 5: Delete characters
Input
Text: "a,b,c,d" β€” Find: , (a comma), Replace: (empty)
Result
abcd (3 replacements)
Why
Leaving the replacement empty removes every match, so all three commas are deleted.

When to use this tool

  • Renaming a variable, term, or name consistently across a block of pasted text or code.
  • Cleaning up data by stripping or swapping characters, such as removing commas, tabs, or extra symbols.
  • Doing pattern-based edits with regex, like collapsing all numbers, emails, or whitespace runs into a single replacement.

Common mistakes

  • Forgetting to turn on "Regular expression" mode and expecting symbols like \d, *, or ( ) to behave as regex β€” in literal mode they are matched as plain characters.
  • Expecting "whole word only" to match inside other words. It uses word boundaries, so "cat" will not match inside "category".
  • Assuming the search is case-insensitive by default. Matching is case-sensitive unless you enable the "Case-insensitive" option.

Frequently asked questions

Does it replace all matches or just the first one?

All of them. The replacement always runs globally, so every occurrence of your search term is replaced in a single pass, and the tool shows you the total replacement count.

How do I use regular expressions?

Turn on the "Regular expression" option, then your search term is treated as a regex pattern. For example \d+ matches any run of digits and \s+ matches whitespace. In the replacement field you can reference captured groups with $1, $2, and so on.

What does "whole word only" do?

It wraps your search term in word boundaries (\b…\b) so it only matches complete words. Searching "cat" will match the standalone word "cat" but not the "cat" inside "category" or "scatter".

How do I delete text instead of replacing it?

Leave the "Replace with" field empty. Every match of your search term is then removed from the text. The replacement count tells you how many were deleted.

Is my text sent to a server?

No. The find-and-replace runs entirely in your browser using the built-in JavaScript engine, so your text never leaves your device and nothing is stored or uploaded.

Why does my search term match unexpected characters?

You are probably in literal mode where every character is matched exactly, or in regex mode where symbols like . or * have special meaning. Switch modes to match your intent β€” literal escapes special characters, regex interprets them.

Can I undo a replacement?

The tool shows the result in a separate read-only box and never overwrites your original input, so you can adjust the find or replace fields and the output updates live. Your source text stays intact until you change it yourself.

Sources & references

External references open in a new tab. We are independent and not affiliated with these organizations.

  • βœ“ Free to use
  • βœ“ No sign-up required
  • βœ“ Runs entirely in your browser β€” nothing is uploaded.
  • βœ“ Formula and method shown above

Provided β€œas is” for general information only β€” results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.

Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.

Related tools

Embed this tool on your site

Free to embed, no sign-up. Paste this code where you want the find and replace text to appear: