Find and replace whole words
Replace a word only where it stands on its own. Turn on Whole word and 'cat' changes in 'the cat sat' but not in 'category' or 'concatenate'; add Case sensitive to leave 'Cat' alone. Plain search is the default, and regex mode is one click away. All processing runs locally in your browser.
Input text
Result
FIND & REPLACE
How it works
In plain mode, the search text is escaped and matched literally using a JavaScript RegExp with the global and Unicode (u) flags. In regex mode, the pattern is used as-is, with the u flag when the pattern is valid with it. The case-insensitive flag is added unless Case sensitive is enabled. The whole-word option skips a match that has a letter, digit or underscore, in any script, directly before or after it. For a pattern that runs without the u flag, only A to Z, a to z, 0 to 9 and _ count as word characters. String.replace() with the RegExp applies the substitution across the entire input on every keystroke. In regex mode that work runs in a background Web Worker and is stopped after 2 seconds. All processing runs in JavaScript in your browser.
Processing runs in your browser
All processing happens locally in your browser tab. Our servers are not involved at any point.
Related operations
For more advanced pattern matching, try the regex tester. To alphabetise or dedupe the result, use sort lines. For comparing two versions of the text side by side, see text diff.
Frequently asked questions
- How do I do a case-sensitive find and replace?
- Toggle the 'Case sensitive' option in the side panel. By default the search is case-insensitive, so 'hello' will match 'Hello', 'HELLO', and 'hello'. With case sensitivity on, only exact-case matches are replaced.
- Can I undo a replacement?
- Because the output is displayed in a separate read-only pane, your original text is always preserved in the input area. You can edit the find or replace fields to adjust the result without losing your original content.
- What does the whole-word option do?
- Whole-word matching only replaces the search term when it appears as a complete word (surrounded by spaces or punctuation). For example, searching for 'cat' with whole-word on will not match 'category' or 'concatenate'.
- Does a $ in the replacement do anything special?
- In plain mode the replacement is inserted exactly as typed, so $1 or $& stays literal text. Turn on Regex to use $1, $2 and $& as references to the match.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to text tools
- Step by step: Extract and clean up text from a PDF