Find and Replace Text Online
This free find and replace tool searches any block of text and swaps one string for another in one pass. Use it for straightforward literal edits — fixing a repeated typo, renaming a term throughout a document, or cleaning up pasted content — or switch on Regex mode for pattern-based replacements with capture groups. A live counter shows exactly how many matches were found before you copy the result.
Everything runs locally in your browser with JavaScript — the text you paste is never uploaded, stored, or transmitted, so it is safe to use with private notes, source code, contracts, or unpublished copy.
How to use Find and Replace
- Paste or type your text into the Input box.
- Enter the word, phrase, or pattern to look for in the Find field.
- Enter the replacement in the Replace with field.
- Choose your options: Case-insensitive, Whole word, Regex mode, Multiline, and whether to replace all matches or only the first.
- The match count and replaced result update instantly — copy the result to your clipboard or download it as a .txt file.
Literal and regular-expression matching
In literal mode (the default) the tool searches for your Find text exactly as typed. Punctuation, spaces, and symbols are all matched verbatim, so you never have to escape special characters — the right choice for everyday substitutions like changing a name or swapping one word for another.
Switch on Regex mode to treat the Find field as a JavaScript regular expression. That unlocks wildcards, character classes, quantifiers, anchors, and capture groups, so you can match every email address, every ISO date, or every trailing whitespace run at once. If the pattern is invalid, the exact error message is shown and your text is left untouched instead of the tool crashing.
Replacement syntax and capture groups
When Regex mode is on, the Replace with field understands the same substitution tokens as JavaScript's String.replace: $1, $2, and so on insert the text captured by each numbered group, $<name> inserts a named group, $& inserts the whole match, and $$ inserts a literal dollar sign. You can also use \n and \t to insert a newline or a tab.
Find: (\w+)@(\w+) Replace: $2.$1 Input: user@example Result: example.user
Matching options explained
- Case-insensitive — matches whether the letters are upper or lower case, so "Cat", "CAT", and "cat" are all found.
- Whole word — wraps the search in word boundaries so "cat" matches the standalone word but not the "cat" inside "category" or "scatter".
- Regex mode — treats the Find field as a regular expression with capture groups and backreferences.
- Multiline — in Regex mode, makes ^ and $ match the start and end of every line instead of the whole text, which is useful for line-anchored patterns.
- Replace all matches — replaces every occurrence by default; uncheck it to change only the first match while still counting the rest.
Related terminology
- Literal match
- A search that matches the Find text exactly as typed, treating regex metacharacters such as . or * as ordinary characters.
- Regular expression
- A pattern language for describing sets of strings, allowing wildcards, character classes, quantifiers, anchors, and capture groups.
- Capture group
- A parenthesised part of a regular expression whose matched text can be reused in the replacement via $1, $2, or a name.
- Backreference
- A token such as $1 or $<name> in the replacement field that inserts the text a capture group matched.
- Word boundary
- The zero-width position between a word character and a non-word character, written \b, used by the Whole word option.
Frequently asked questions
- What is the difference between literal and regex find and replace?
- Literal mode matches your Find text exactly, so symbols like . or * are treated as ordinary characters and nothing needs escaping. Regex mode treats the Find field as a JavaScript regular expression, letting you match patterns — any digit, any email, any line ending in a comma — and reuse captured text in the replacement.
- How do I use capture groups in the replacement?
- Turn on Regex mode, wrap the parts you want to reuse in parentheses, then reference them in the Replace with field using $1, $2, and so on, or $<name> for a named group. For example, the pattern (\d{4})-(\d{2})-(\d{2}) with the replacement $3/$2/$1 rewrites 2026-08-11 as 11/08/2026.
- How do I replace only the first match instead of all of them?
- Uncheck "Replace all matches". The tool then changes only the first occurrence and leaves the rest of the text as it is. The match count still shows how many matches exist in total.
- What does the Whole word option do?
- It surrounds your search with word boundaries so only complete words match. With Whole word on, searching for "art" changes the standalone word but leaves "start", "party", and "chart" untouched.
- My regular expression shows an error — what happened?
- When a pattern is not valid, for example an unclosed group or an unbalanced bracket, the tool shows the exact error message and leaves your text unchanged instead of crashing. Fix the pattern and the result updates automatically.
- Is my text uploaded to a server?
- No. All searching and replacing happens in your browser with JavaScript, so your text never leaves your device — safe for private notes, code, and unpublished drafts.