Free Find and Replace Text
Search and replace text with plain or regex matching, a live match count, and a highlighted preview. Supports case-insensitivity, whole-word, and regex capture-group backreferences.
💡 In regex mode, use capture groups in Find like (\d{4})-(\d{2}) and reference them in Replace with $1, $2 — great for reformatting dates, names, or IDs in bulk.
Common uses
- Bulk Find and Replace TextReplace every occurrence of a word or phrase across a block of text at once.
- Regex Find and ReplaceUse regular expressions with capture groups to reformat text in bulk.
- Find and Replace in CodeRename variables or rewrite patterns across a snippet quickly.
- Clean Up Messy DataStrip or normalize stray characters, delimiters, and formatting in pasted data.
- Replace Words While WritingSwap a repeated word or rename a character throughout a draft.
How It Works
Find and Replace runs entirely in your browser using JavaScript's built-in RegExp engine — no library, no server, no upload. Text is processed locally the moment you type, using String.prototype.matchAll for counting and String.prototype.replace for substitution.
- 1Pattern compiled to RegExpAs you type, the find term is compiled into a JavaScript RegExp with a 150 ms debounce so pathological patterns don't freeze the tab on each keystroke. In plain-text mode every regex metacharacter is escaped first, so literal dots and brackets are treated as literals. Enabling Regex mode passes your pattern straight through. Whole-word mode wraps the pattern in \b(?:...)\b word-boundary anchors, and Case-insensitive mode appends the i flag.
- 2Single matchAll pass counts and highlightsOne matchAll call over the debounced text produces every match object. The match count is read directly from that array length. For texts under 200,000 characters, a highlighted preview is built by walking the match offsets and wrapping each hit in a <mark> tag — HTML-escaping is applied to the raw text segments before injection, not after, so matches containing &, <, or > are handled correctly.
- 3Replace with literal text or capture-group backreferencesThe output is produced by String.prototype.replace with the global flag, replacing every match at once. In plain-text mode, any $ in the replacement string is doubled to $$ so characters like $& and $1 are inserted verbatim rather than interpreted as backreferences. In Regex mode, $1, $2, etc. work as standard JavaScript capture-group substitutions.
- 4Copy or download the resultThe rewritten text appears in a read-only textarea as you type. Copying uses the browser's navigator.clipboard.writeText API. Downloading constructs a Blob of type text/plain synchronously and triggers a local save — nothing leaves your device at any point.
Guide
Worked example
Say a list has dates written year first and you need day first. Paste "Invoice 2026-11-04 due 2026-12-15" into "Your text", tick "Regular expression", type (\d{4})-(\d{2})-(\d{2}) in "Find" and $3/$2/$1 in "Replace with". The line under the boxes says "2 matches found", both dates are highlighted, and "Result" reads "Invoice 04/11/2026 due 15/12/2026". With the box unticked the same text is searched literally, so a search for . in a.b.c finds 2 matches (the dots), while with the box ticked it finds 5, because . then means any character. The "Collapse multiple spaces" quick cleanup turns "a b c d" into "a b c d" (3 matches).
Which settings to use, and the limits
- Start with plain text. With "Regular expression" unticked, what you type in "Find" is searched exactly as written, and a $ in "Replace with" is inserted as a plain dollar sign. Tick the box only when you need patterns such as digits, optional parts or groups.
- Check the case and whole-word options. Matching is case-sensitive unless "Case-insensitive" is ticked, so "cat" does not find "Cat". "Whole word" stops "cat" matching inside "concatenate" and "category". It also works for accented words such as café and for Chinese and Japanese text, where every character edge counts as a word edge. In "cat concatenate Cat category cat." a plain search for cat finds 4, and case-insensitive plus whole word finds 3.
- In regex mode, mind the line anchors. The patterns use JavaScript regular expression syntax. There is no multiline option, so ^ and $ match only the start and end of the whole text, not of each line, and . does not cross a line break. To anchor to each line, use (?<=^|\n) for a line start and (?=\r?\n|$) for a line end. Capture groups in "Find" come back as $1, $2 in "Replace with".
- Use the quick cleanups. Under "Quick cleanups" are ten one-click presets: "Straighten double quotes", "Straighten single quotes", "Collapse multiple spaces", "Remove line breaks", "Tabs to spaces" (four spaces), "Trim trailing whitespace", "Remove empty lines", and three for Chinese and Japanese text that convert full-width characters, convert punctuation to full-width, and remove spaces between characters. A preset fills in Find and Replace and ticks "Regular expression". The two presets that convert characters stop converting as soon as you edit either box.
- Load a file instead of pasting. "Load a text file" opens .txt, .csv, .log and .md files, or other text files, and reads them in your browser. A file that looks binary is refused, and a file of a clearly different type, such as a DOCX or PDF, is turned away with a message naming its type. "Download .txt" saves the result under the original file name and extension, so orders.csv stays orders.csv; for pasted text the file is called find-replace-result.txt.
- Expect a pause on very large text. Results update about 0.15 seconds after you stop typing, 0.35 seconds once the text passes 200,000 characters and 0.7 seconds past 1,000,000. Above 200,000 characters the highlighted preview is switched off and the page says "Highlight preview is disabled for very large text - the result below is still up to date." The match count and the result keep working. The tool does not check file size itself, so a very large file is limited by your browser's memory.
Common problems and how to fix them
- It says "Invalid regex".
- Your pattern is not valid regular-expression syntax. This usually happens when "Regular expression" is ticked while you search for ordinary text that contains symbols such as ( [ * + ? or a backslash. In Chrome, for example, C++ gives "Nothing to repeat", [abc gives "Unterminated character class" and a lone ( gives "Unterminated group". Untick the box to search for the text literally, or put a backslash before each symbol, as in C\+\+. Open "Details" to see the browser's own message; its wording varies by browser and is shown in English.
- It says "Could not read that file. Please choose a plain text file (.txt, .csv, .log, .md)."
- The file looks binary: its first 4,096 characters contain a NUL character, as in a Word, Excel or PDF file renamed to .txt, or the browser could not read it. Open the original in its own program and copy the text, or save it as plain text or CSV first. A file of a clearly different type is usually refused earlier, with a message like "report.docx is a DOCX file, which this tool can't open."
- It says "0 matches found" although the text is clearly there.
- Check, in this order: matching is case-sensitive unless "Case-insensitive" is ticked; "Whole word" is ticked and the text sits inside a longer word; "Regular expression" is ticked and a character such as . or ( is acting as a pattern; or the spaces, tabs and line breaks in your text are not what you typed. The count updates a fraction of a second after you stop typing, so wait a moment after a change.
- The replacement shows $1 or $& as typed instead of the matched text.
- References such as $1 only work with "Regular expression" ticked, and only when "Find" contains a matching group in brackets, for example (\d+). With the box unticked every $ is inserted exactly as typed. If the pattern has no first group, JavaScript also leaves $1 as plain text.
- I typed \n in "Replace with" and got a backslash and an n instead of a line break.
- "Replace with" is a one-line box and does not turn \n into a line break, so it inserts the two characters. In "Find", with "Regular expression" ticked, \n and \r?\n do match line breaks, which is how "Remove line breaks" and "Remove empty lines" work. A line break cannot be typed into the replacement, so to add line breaks use a text editor that supports it.
How it compares
A word processor or code editor steps through matches one at a time, edits the document in place, can work across many files and offers undo. This page does the opposite: it replaces every match at once in a copy of your text, shows a live count and highlighted matches first, and leaves your original in the first box until you change it. Its regular expressions are JavaScript's, which differ in details from the flavors in other editors and command-line tools. For example, named groups are written (?<name>...) and not (?P<name>...), there are no per-line anchors, and a line break cannot be typed into the replacement. It suits one pasted block or one log or CSV file; for a whole folder of files, use an editor or a script.
Related Tools
Find and Replace in Word, PowerPoint & Excel
Replace words in .docx, .pptx and .xlsx files without Office: several find → replace pairs, many files at once, match case, whole words or regex. Formatting, images and layout stay as they are; nothing is uploaded.
Bulk File Renamer
Rename many files at once: find and replace (or regex), letter case, prefix, suffix, numbering and the date a photo was taken. Live preview, then download the renamed files as a ZIP. Works on any device; nothing is uploaded.
Emoji Picker
Search and copy emoji with one click. Browse by category, build a string of several emoji, choose a skin tone and find the ones you used recently.