Summary: find and replace text free and private
Find and replace searches a text for a word, phrase or pattern and swaps every match for new text. To find and replace text free and privately, paste your text into Input Text above, or open a file with Choose File, type what to find in Find and the new text in Replace With. The Result appears below with every match highlighted and counted. Nothing is uploaded: the work happens in your browser.
Four options change how matching works. Case Sensitive is off by default, so hello also matches Hello. Whole Word skips matches inside longer words. Regular Expression switches to JavaScript patterns, and the replacement can then use $1, $<name>, $&, \n for a new line and \t for a tab. Replace All is on by default; turn it off to replace only the first match. With Regular Expression off, everything you type is matched and inserted exactly as typed.
Table of Use: find and replace examples
| Task | Find | Replace With | Option | Before โ after |
|---|---|---|---|---|
| Fix a spelling | colour | color | None | The colour of the colour wheel โ The color of the color wheel |
| Match whole words only | cat | dog | Whole Word | cat category cat. โ dog category dog. |
| Delete characters | - | (empty) | None | 555-123-4567 โ 5551234567 |
| Change a date format | (\d{2})/(\d{2})/(\d{4}) | $3-$2-$1 | Regular Expression | 25/12/2026 โ 2026-12-25 |
| Swap name order | (?<first>\w+) (?<last>\w+) | $<last>, $<first> | Regular Expression | Ada Lovelace โ Lovelace, Ada |
| One item per line | , | \n | Regular Expression | a, b, c โ a, b and c on three lines |
| Trim trailing spaces | [ \t]+$ | (empty) | Regular Expression | Spaces and tabs at the end of each line are removed |
| Prefix every line | ^ | > | Regular Expression | one and two โ > one and > two |
| Insert a dollar sign as typed | USD | $$ | None | Price: 20 USD โ Price: 20 $$ |
In Regular Expression mode, ^ and $ match at the start and end of every line, and lookahead, lookbehind and Unicode classes such as \p{L} are available. For example, (?<=\$)\d+ matches a number only when a dollar sign comes right before it.
Features
- Plain or regex matching. Whole Word understands accented letters and other alphabets, so cafรฉ is matched as one word.
- Several rules. Add another find/replace pair for each extra rule; they run top to bottom, and each rule shows its own match count.
- Saved rule sets. Name a set, then load or delete it later. Sets live in this browser's local storage only.
- Highlighted preview and match count. The preview marks matches in the first 200,000 characters, up to 5,000 highlights; the replacement itself covers the whole text.
- Use as Input, Undo and Redo. Make the result your new input to chain another replacement, and step back with Undo (up to 50 steps) or forward with Redo.
- Text files. Open .txt, .md, .json, .xml, .csv, .tsv, .log, .html, .css, .js, .yaml, .srt, .sql and similar files up to 25 MB. Download names the result after the file, as in notes-replaced.txt.
- A guard for slow patterns. A search that takes longer than 3 seconds is stopped instead of freezing the page.
After replacing, the text diff tool shows exactly what changed between the original and the result, and the character counter can reveal stray characters, such as no-break spaces, to search for. The text case converter handles capitalisation, which Find and Replace leaves alone unless you type the exact case.
How to Use Find and Replace
- Paste your text into Input Text, or click Choose File to open a text file.
- Type what to find in Find and the new text in Replace With. Leave Replace With empty to delete every match.
- Tick Case Sensitive, Whole Word or Regular Expression as needed, and untick Replace All to change only the first match.
- Check the match count and the highlighted preview, then read the Result.
- Click Copy or Download to keep it, or Use as Input to run another replacement on it. Undo reverses that step.
- For more than one change, click Add another find/replace pair, and use Saved rule sets to keep the list.
Who Can Use Find and Replace
Writers and editors standardise spellings and terms across a long draft. Developers rename an identifier with Whole Word on, switch http links to https in HTML, or reshape log lines with capture groups; the JSON formatter and URL encoder cover related jobs. Analysts clean CSV exports, then use the remove duplicate lines tool, the remove empty lines tool or the sort lines alphabetically tool. Subtitle and translation editors can open .srt files, and the word counter checks the length of the result.
FAQs
How do I find and replace text online?
Paste your text into Input Text, or click Choose File to open a text file. Type what to find in Find and the new text in Replace With. The match count, a highlighted preview and the Result update as you type. Tick Case Sensitive, Whole Word or Regular Expression if you need them, then click Copy or Download.
How do I replace line breaks?
Turn on Regular Expression and type \n in Find to match each line break. Replace it with a space to join the lines, or with a comma. To insert line breaks, type \n in Replace With while Regular Expression is on: finding a comma and a space and replacing them with \n puts every item of a comma-separated list on its own line.
Can I use capture groups like $1 in the replacement?
Yes, with Regular Expression on. $1, $2 and so on insert numbered groups, $<name> inserts a named group and $& inserts the whole match. For example, find (\d{2})/(\d{2})/(\d{4}) and replace with $3-$2-$1 to turn 25/12/2026 into 2026-12-25. With Regular Expression off, the replacement is inserted exactly as typed, so $ and \ have no special meaning.
What is the difference between Replace All and replacing only the first match?
Replace All is on by default and changes every match. Switch it off and only the first match of each rule is replaced, while the counter still reports every match and notes that only the first is replaced. That helps when you want to test a pattern, or change just the first heading, link or date in a document.
How do I find and replace several words at once?
Click Add another find/replace pair for each extra rule. Rules run in order, top to bottom, each on the result of the one before, and every rule shows its own match count. Because they chain, a rule that turns a into b followed by one that turns b into c changes both. Under Saved rule sets you can name a set and load it later.
Why does my regular expression show an error or stop?
An invalid pattern, such as an unterminated group, shows a red message with the reason, and your text is left unchanged until you fix it or turn off Regular Expression. A search that runs longer than 3 seconds, usually because of nested repeats such as (a+)+, is stopped so the page does not freeze, and a message asks you to simplify the pattern.
How do I replace special characters such as a dot, dollar sign or backslash?
Leave Regular Expression off and type the character as it is. Every character is then matched and inserted literally, so replacing USD with $$ gives $$. In regex mode, escape characters that have a meaning with a backslash, for example \. for a period, \* for an asterisk or \$ for a dollar sign.
Is it safe to paste private text or files into this tool?
Yes. Searching and replacing run in your browser, and files you open with Choose File (UTF-8 text, up to 25 MB) are read on your device. Nothing is uploaded, which you can check in the Network tab of DevTools. The one thing stored is a saved rule set: your find and replace pairs and options are kept in this browser's local storage, never your text.