Find and Replace Text Online — Free, with Regex & Whole-Word Modes
Paste text, type what to find, type the replacement — see the result and a live match count instantly. Use plain literal mode (with case-insensitive and whole-word toggles) or regex mode with capture groups and $1/$2backreferences. Runs 100% in your browser.
Hello there! Contact us at hello@toolk.site, support@toolk.site, or press@toolk.site.
We will reply within 24 hours. Multiple spaces need fixing.
#feedback #toolk #2026 🚀Literal or Regex
Toggle between plain-text find (with whole-word and case-insensitive options) and full ECMAScript regex with capture-group backreferences ($1, $2 in the replacement).
Backreferences Work
In regex mode, capture groups in the find pattern (parentheses) can be referenced as $1, $2 in the replacement — swap columns, restructure dates, normalize casing.
Live Match Count
See exactly how many matches will be replaced before confirming. Recipe presets demonstrate common patterns (strip emoji, mask emails, collapse spaces).
100% Client-Side
All find-and-replace runs in your browser via native String.replace. Text never leaves the page — safe for logs, configs, or any sensitive content.
Find and Replace Text in Bulk — Plain or Regex
Find and Replace swaps every occurrence of one string for another across a block of text. Paste your input, type a find term and a replacement, and the output updates live with a match count. Use plain literal modewith case-insensitive and whole-word toggles, or regex mode for pattern matching with capture groups and $1/$2 backreferences. It is free and runs 100% in your browser with no upload.
How to find and replace text
- Paste or type your text into the input pane on the left.
- Type the Find term, then the Replace string. The output and match count update as you type.
- For plain swaps, leave regex off and use the Case-insensitive and Whole word toggles as needed.
- For patterns, turn on Regex — add parentheses to capture groups and reference them as
$1,$2in the replacement. Enable Multiline to anchor^and$to each line. - Copy the result, or click Apply replacement to input to chain another find-and-replace on the output.
How find and replace works
Find and replace performs a search-and-substitute over text. In literal modeyour find term is matched character-for-character; in regex mode it is compiled into a JavaScript RegExp and matched as a pattern. This tool always uses the global flag (g), so every occurrence is replaced, not just the first. The replacement string supports special tokens defined by the ECMAScript String.prototype.replace spec: $1–$99 for capture groups, $& for the whole match, and $$ for a literal dollar sign.
The case-insensitive toggle adds the i flag, so Apple, APPLE, and apple all match. The whole-word toggle (literal mode only) wraps your term in \b word boundaries so cat matches the word but not category. The multiline toggle adds the m flag, which changes ^ and $ from matching the start and end of the whole input to matching the start and end of every line.
Worked examples: find → replace
Literal · whole word on
find: cat → replace: dog — "the cat in category" becomes "the dog in category"
Regex · capture groups
find: (\d{4})-(\d{2})-(\d{2}) → replace: $3/$2/$1 — 2026-05-11 becomes 11/05/2026
Regex · multiline on
find: ^\s+ → replace: (empty) — strips leading whitespace from every line
Edge case · literal $ in the replacement
Want to replace USD with $1.00? In literal mode that $1 would normally be read as a capture-group backreference and vanish. This tool auto-escapes every $in a literal replacement to $$, so $1.00 comes out exactly as typed. Switch to regex mode only when you actually want $1 to mean a capture group.
Syntax Reference
| Feature | Syntax / Toggle | Notes |
|---|---|---|
| Plain text (literal mode) | find: cat → replace: dog | Replaces every occurrence of the literal string. Use whole-word toggle to avoid partial matches. |
| Case-insensitive | + Aa toggle | Adds the "i" flag — "Apple", "APPLE", "apple" all match the same pattern. |
| Whole word only | + "Wb" toggle (non-regex mode) | Wraps the literal pattern in \b boundaries; matches "cat" but not "category". |
| Regex character class | find: [aeiou] → replace: * | Replaces every vowel with an asterisk. Square brackets define a set. |
| Regex backreference | find: (\w+) (\w+) → replace: $2 $1 | Captures two words with parentheses, swaps them. $1, $2 reference the captures. |
| Regex anchors | find: ^foo → replace: bar (multiline) | "^" matches line start when multiline mode is on; otherwise only the very start. |
| Regex quantifiers | find: \d{3,5} | Matches 3 to 5 digits. {n,m} = at least n, at most m occurrences. |
Five Practical Find-and-Replace Recipes
1. Anonymize Email Lists
find: \b[A-Za-z0-9._%+-]+@\S+\b → replace: [email]
Replace every email with [email] before sharing logs externally. Regex mode on.
2. Collapse Duplicate Spaces
find: " +" → replace: " "
Normalize whitespace from scraped or copy-pasted content. Regex mode on.
3. Reorder Date Formats
find: (\d{4})-(\d{2})-(\d{2}) → replace: $3/$2/$1
Convert ISO 8601 dates to US format using capture-group backreferences.
4. Strip Trailing Whitespace
find: \s+$ → replace: (empty) · multiline on
Clean trailing whitespace from every line of pasted source code.
Four Pitfalls to Watch For
1. Greedy Quantifiers Match Too Much
In regex, .* is greedy — it matches as much as possible. For HTML-like content, use .*? (non-greedy) instead. Otherwise <b>hello</b> world <b>again</b> collapses across both tags.
2. Special Characters Need Escaping
In regex mode, . matches any character. To match a literal period, write \. — same for ( ) [ ] * + ? | ^ $ \\. Literal mode handles this automatically.
3. Substring vs Word Match
Searching "cat" matches inside "category", "scattered", "duplicate". Turn on Whole Word (literal mode) or add \b boundaries (regex mode) when you want word-only matches.
4. Replace With $1 Without Capture
$1 in the replacement is meaningless if your find pattern has no parentheses. The output will contain literal "$1" characters. Add ( ) around the part of the pattern you want to capture.
The literal-mode trap most find-and-replace tools fall into
JavaScript's native String.replace treats $1, $&, and $$ as special replacement tokens even when the find term is a plain string. So a naive literal find-and-replace that swaps price for $1 each silently drops the $1, because there is no capture group to back-reference. This tool escapes every $ in a literal replacement to $$ before substituting, so dollar signs always survive. In regex mode the tokens are honored, giving you full backreference power.
Two more concrete limits: the match preview lists up to 200 matches with their line and column, and the engine guards against zero-width matches (an empty regex match advances the cursor by one so the loop never hangs). Every replace uses the global flag, so the live count is the exact number of substitutions that will happen.
Runs 100% in your browser
Your text never leaves your device. Matching and substitution run locally via native String.replace — no uploads, nothing leaves your device — so the tool is safe for log files, config files with secrets, and any sensitive content. I tested it on multi-megabyte pasted logs, each of the five recipe presets, capture-group date reordering, multiline whitespace stripping, and the literal $ edge case. Output stays instant and the match count matched a manual grep count in every run.
Frequently asked questions
Is this find and replace tool free?
Yes — 100% free with no signup and no usage cap. Replace text in literal or regex mode without limits beyond what your browser can hold in memory.
Does my text get uploaded to a server?
No. The replace runs entirely in your browser via native String.replace. Check DevTools → Network and you will see no request during a replace. Everything stays on your device.
How do I swap words or columns with regex?
Turn on regex, wrap each part in parentheses, and reference them as $1, $2 in the replacement. Find (\w+) (\w+) with $2 $1 swaps two words; the "Swap first and last (CSV)" recipe does the same for comma-separated columns.
Does it replace every match or just the first?
Every match. The pattern always runs with the global flag, so all occurrences are replaced at once and the live count shows the total before you apply.
Related text & Markdown tools
Develop and debug a pattern before applying
Text SorterSort and dedupe lines around your replace
Diff CheckerVerify the replaced text against the original
Case ConverterUpper, lower, title, and snake casing
Word CounterCount words and characters after editing
URL Slug GeneratorTurn cleaned text into a URL slug
Markdown EditorDraft and preview Markdown content live
Markdown to HTMLConvert Markdown to clean HTML
Markdown Table GeneratorBuild Markdown tables from rows
Markdown TOCGenerate a table of contents from headings
Lorem Ipsum GeneratorGenerate placeholder text to edit
All ToolsBrowse the full Toolk utility hub
Guide: Markdown SyntaxRead the full Markdown syntax guide
Guide: Text Tools for CreatorsThe text-processing workflow guide
Last updated: June 2, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.
Need a different tool?
Browse all 89 free, in-browser tools — or tell us what we should build next.