ToolBook
Support us on Ko-fi
Help us keep this free, forever

Find and Replace

How to use Find and Replace

Paste text, type what to find, type the replacement, copy the result.

  1. Paste your text

    Drop the source text into the input panel. The whole document stays in your browser, so nothing is uploaded.

  2. Enter the find pattern

    Type the literal string to find, or toggle "Regex" and type a JavaScript regex. The match count updates live; matches are highlighted in the input.

  3. Tune the search

    Toggle case sensitivity, whole-word matching, and multiline mode. Each toggle re-runs the match instantly.

  4. Enter the replacement

    Type what to replace each match with. Use $1, $2 in regex mode to reference capture groups. The output panel updates as you type.

  5. Copy the result

    Hit "Copy output" for the clipboard. Hit "Apply to input" to chain another replacement on the new text.

Frequently asked questions

How do I find and replace text online with this tool?

Paste your text into the input panel, type the search term in the find field, type the replacement in the replace field, and the output updates as you type. Hit Copy to put the result on your clipboard. Everything runs in your browser, so no upload happens.

Does this support full regular expressions?

Yes. Toggle Regex to switch from literal-string search to JavaScript-flavored regex. Capture groups, lookarounds, character classes, and Unicode property escapes (\p{L}, \p{N}) are all supported. Use $1, $2, and so on in the replacement field to reference captured groups.

How do I find and replace multiple words or patterns at once?

Run the first replacement, hit Apply to input to chain the result back into the input panel, then run the next find-and-replace on it. Each pass is one rule, so chaining lets you cover a sequence of replacements without leaving the page. For one-shot multi-pair input, regex alternation works too: pattern (foo|bar|baz) with replace $1 matches all three.

What does Whole word do exactly?

Whole-word search wraps your pattern in \b word boundaries, matching only when the pattern is bordered by non-word characters or string edges. So "cat" matches in "the cat sat" but not in "category" or "concat". Useful when you want to rename a variable or term without catching it inside larger words.

Is the original text overwritten?

No. The output appears in a separate panel beside the input. Hit Copy to put the replaced version on your clipboard, or Apply to input if you want to chain another replacement on the result.

Why does my regex throw an invalid error?

You probably have an unbalanced bracket, parenthesis, or backslash. The error message under the find field shows the exact engine error. Common culprits: a single backslash without an escape, a (group missing its closing ), or a [character class missing its ].

Can I replace newlines or tabs?

Yes. In regex mode, use \n for newline and \t for tab in both the find and replacement fields. In literal mode, paste the actual character (a real newline or a real tab) into the field. The Multiline toggle changes how ^ and $ behave but not how \n is matched.

Is the find and replace case sensitive by default?

No. Case sensitivity is off by default, so "Apple" matches "apple" and "APPLE". Flip the Aa Case toggle to make the search case-sensitive. The toggle re-runs the match instantly without losing your text.

How is this different from VS Code find-and-replace?

It's the same regex engine, JavaScript's built-in one. The difference is reach: this tool runs on any text you can paste, regardless of whether you have an editor open. Use it for emails, Slack messages, CSV cells, JSON pasted from logs, anywhere opening VS Code would be overkill.

Find-and-replace, in your browser

Literal vs regex, the four toggles, and patterns worth bookmarking.

When you need find-and-replace and you don't have an editor open

Find-and-replace is the most-used feature in every text editor. The reason it's also one of the most-Googled "online tool" queries is mundane: people don't always have an editor open. They have a browser open, a chunk of text in their clipboard, and one search-and-replace operation to run before they can move on.

This tool lives in that gap. Paste text, type the find pattern, type the replacement, copy the result.

Literal vs regex mode

Default mode is literal: whatever you type in the Find field is what gets matched, character for character. "cat" matches "cat", including inside "category" or "concat" if "Whole word" isn't on.

Toggle "Regex" and the Find field becomes a JavaScript regex source. Same engine VS Code, IntelliJ, and your browser's DevTools use. So \\b\\w+@\\w+\\.\\w+\\b matches an email-shaped token, \\d{4}-\\d{2}-\\d{2} matches an ISO date, and \\s+$ (with the multiline flag on) strips trailing whitespace from every line.

The four toggles, in plain language

Aa Case: when on, "Apple" only matches "Apple" and not "apple" or "APPLE". Off by default because most search-and-replace work is case-insensitive.

\b Whole word: wraps the pattern in word boundaries. Stops "cat" from matching inside "category". Equivalent to checking the "Match whole word" box in any editor.

. Regex*: flips Find from literal to JavaScript regex. The replacement field also changes meaning: $1, $2, $3 reference capture groups; $& references the whole match; $$ is a literal dollar sign.

¶ Multiline: toggles the regex m flag, which makes ^ and $ match the start and end of each line instead of the start and end of the whole string. Useful for line-by-line patterns like "anchor on every line that starts with #".

A few patterns worth bookmarking

  • Strip leading/trailing whitespace per line: Find: ^\\s+|\\s+$ · Replace: empty · Toggles: regex + multiline
  • Collapse multiple spaces to one: Find: \\s+ · Replace: (single space) · Toggle: regex
  • Remove blank lines: Find: ^\\s*\\n · Replace: empty · Toggles: regex + multiline
  • Wrap each line in quotes: Find: ^(.+)$ · Replace: "$1" · Toggles: regex + multiline
  • Convert CamelCase to kebab-case: Find: ([a-z])([A-Z]) · Replace: $1-$2 · Toggle: regex (then lowercase the whole thing in the Case Converter)
  • Extract dollar amounts: Find: \\$\\d+(\\.\\d{2})? · Toggle: regex (find only, no replacement)

Why running it in your browser is fine

Every operation runs locally in JavaScript. The text never leaves the page. There's no server call, no log, no analytics tied to the content. You can paste a confidential email or a redacted internal document and the tool works the same.

This matters because find-and-replace is what people use to anonymize text. Replace every customer name with [REDACTED], replace every SSN-shaped string with XXX-XX-XXXX, replace every email with [email removed]. Doing that in a tool that uploads your text would defeat the entire purpose. We don't.

When VS Code is still the right answer

For very large files (>1 MB), for projects that need to find-and-replace across many files at once, or for find-and-replace that interacts with code structure (rename a variable everywhere except in comments), an editor remains the right tool. This page is for the in-between cases: small chunks of text, one operation, no setup.