stakritools
Developer
  • Base64 Encoder/Decoder
  • Color Picker & Converter
  • CSS Minifier
  • CSV to JSON Converter
  • Hash Generator
  • HTML Minifier
  • JS Minifier
  • JSON Formatter & Validator
  • JSON to CSV Converter
  • JWT Decoder
  • Markdown Editor
  • Password Generator
  • Regex Tester
  • SQL Formatter
  • Unix Timestamp Converter
  • URL Encoder/Decoder
  • UUID Generator
  • XML Formatter
  • YAML Formatter
View all
Image
  • Favicon Generator
  • Image Compressor
  • Image Cropper
  • Image Flipper
  • Image Resizer
  • Image Rotator
  • Image to Base64
  • JPG to PNG Converter
  • PNG to JPG Converter
  • QR Code Generator
  • SVG to PNG Converter
  • Watermark Image
  • WebP Converter
View all
SEO
  • FAQ Schema Generator
  • Meta Description Generator
  • Open Graph Generator
  • Robots.txt Generator
  • SEO Site Auditor
  • SERP Preview
  • Slug Generator
  • Twitter Card Generator
View all
Text
  • Case Converter
  • Find and Replace
  • Lorem Ipsum Generator
  • Random Text Generator
  • Remove Duplicate Lines
  • Remove Extra Spaces
  • Text Diff Checker
  • Word Counter
View all
Calculator
  • Age Calculator
  • BMI Calculator
  • Compound Interest Calculator
  • Date Difference Calculator
  • Discount Calculator
  • EMI Calculator
  • GST Calculator
  • Income Tax Calculator
  • Loan Calculator
  • Percentage Calculator
  • SIP Calculator
  • Tip Calculator
  • Unit Converter
View all
Blog
stakritools

205+ free, browser-based tools for developers, marketers, and creators — no sign-up, no clutter.

Developer Tools

  • Base64 Encoder/Decoder
  • Color Picker & Converter
  • CSS Minifier
  • CSV to JSON Converter
  • Hash Generator
  • HTML Minifier
  • JS Minifier
  • JSON Formatter & Validator
  • JSON to CSV Converter
  • JWT Decoder
  • Markdown Editor
  • Password Generator
  • Regex Tester
  • SQL Formatter
  • Unix Timestamp Converter
  • URL Encoder/Decoder
  • UUID Generator
  • XML Formatter
  • YAML Formatter

Image Tools

  • Favicon Generator
  • Image Compressor
  • Image Cropper
  • Image Flipper
  • Image Resizer
  • Image Rotator
  • Image to Base64
  • JPG to PNG Converter
  • PNG to JPG Converter
  • QR Code Generator
  • SVG to PNG Converter
  • Watermark Image
  • WebP Converter

SEO Tools

  • FAQ Schema Generator
  • Meta Description Generator
  • Open Graph Generator
  • Robots.txt Generator
  • SEO Site Auditor
  • SERP Preview
  • Slug Generator
  • Twitter Card Generator

Text Tools

  • Case Converter
  • Find and Replace
  • Lorem Ipsum Generator
  • Random Text Generator
  • Remove Duplicate Lines
  • Remove Extra Spaces
  • Text Diff Checker
  • Word Counter

Calculator Tools

  • Age Calculator
  • BMI Calculator
  • Compound Interest Calculator
  • Date Difference Calculator
  • Discount Calculator
  • EMI Calculator
  • GST Calculator
  • Income Tax Calculator
  • Loan Calculator
  • Percentage Calculator
  • SIP Calculator
  • Tip Calculator
  • Unit Converter

Company

  • Blog
  • About
  • Privacy Policy
  • Contact
© 2026 stakritools. All rights reserved.
  1. Home
  2. Text
  3. Find and Replace
Text

Find and Replace

Find and replace text instantly, with case-sensitive, whole-word, and regular expression modes. See a live match count, highlighted matches, and replace the first match or every match at once.

Try:

How To Use

  1. 1.Paste or type your text into the main input box.
  2. 2.Type what you want to find, and what you want to replace it with.
  3. 3.Toggle Case Sensitive, Whole Word Only, or Regex Mode to control exactly how matches are found.
  4. 4.Watch the live match count and highlighted preview update as you type, before you replace anything.
  5. 5.Click Replace First to replace only the first match, or Replace All to replace every match at once.
  6. 6.Copy the result to your clipboard, download it as a .txt file, or share a link to this tool. Use Reset to clear everything.

Examples

Simple word swap
A plain literal find and replace across a short sentence.
Whole word only
Whole Word Only skips 'category' and 'concatenate', matching only the standalone word 'cat'.
Regex: digits to X
A regex pattern replacing every run of digits with a single placeholder.
Regex: capture groups
Using $1 and $2 to rewrite matched email addresses using their captured groups.

About Find and Replace

The Three Matching Modes Explained

By default, this tool searches for your Find text as plain, literal characters with no special interpretation — what you type is exactly what gets matched, character for character, regardless of any punctuation or symbols involved. Whole Word Only adds a boundary requirement on top of that: a match only counts if it appears as a complete standalone word, not as a fragment embedded inside a longer word. Regex Mode replaces literal matching entirely with full regular expression pattern matching, unlocking wildcards, character classes, alternation, and capture groups for much more powerful and flexible searches. These three modes can be combined — for instance, a regex pattern with whole-word boundaries enforced — giving you fine-grained control over exactly what counts as a match.

Why Case Sensitivity and Whole-Word Matching Matter

Case sensitivity determines whether 'Word' and 'word' are treated as the same text or as genuinely different text — appropriate default behavior depends heavily on context: prose and everyday text usually benefits from case-insensitive matching (so you don't have to search separately for every capitalization variant), while code, proper nouns, or anything where case carries real meaning usually benefits from case-sensitive matching instead. Whole-word matching solves a different, very common problem: without it, searching for a short word like 'cat' would also match that same sequence of letters buried inside longer, unrelated words like 'category' or 'concatenate' — Whole Word Only prevents these accidental partial matches by requiring your search term to stand alone as its own complete word.

Regular Expressions: When Plain Text Isn't Enough

Literal text matching works well when you know exactly what you're looking for, character for character — but plenty of real-world find-and-replace needs involve a pattern rather than one fixed string: any sequence of digits, any word starting with a capital letter, one of several alternative spellings, or text following a specific structural pattern. Regular expressions (regex) are a widely-used, standardized mini-language for describing exactly this kind of pattern, supported natively by JavaScript (and by nearly every modern programming language). Enabling Regex Mode in this tool switches your Find text from literal matching into full regex pattern matching, and further lets your Replace text reference captured groups from the pattern using `$1`, `$2`, and so on — letting you not just find pattern-based matches, but restructure the matched text intelligently based on its own captured pieces.

How the Live Highlighted Preview Helps

Rather than blindly running a replace operation and hoping it did what you expected, this tool highlights every current match directly in a live preview as you type your Find pattern and adjust the matching toggles — so you can visually confirm exactly which parts of your text would be affected before committing to an actual replacement. This is especially valuable once Regex Mode is involved, since regex patterns can sometimes match more (or less) than a first glance at the pattern might suggest; seeing the actual highlighted matches removes the guesswork and lets you refine your pattern interactively until it's highlighting precisely the text you intend to replace.

Replace First vs. Replace All: Choosing the Right Action

Replace All is the more commonly used action, applying your replacement to every single match found throughout the entire text in one step — the right choice whenever you want a change applied consistently everywhere it occurs. Replace First is useful in narrower situations: when you specifically want to fix or change just one occurrence (perhaps the very first mention of a term, while leaving later, intentionally different mentions untouched), or when you're testing a Find pattern's behavior on a single match before committing to replacing every instance across a longer document. Since both actions use the exact same Find pattern, Replace text, and toggle settings, you can freely try Replace First first to sanity-check the result, then switch to Replace All once you're confident the pattern is doing exactly what you expect.

FAQs

Replace First finds and replaces only the very first match in your text, leaving every other occurrence untouched — useful when you specifically want to fix just one instance without affecting the rest. Replace All finds and replaces every single match throughout the entire text in one action. Both buttons use exactly the same Find pattern and current toggle settings; they only differ in how many matches get replaced.

When off (the default), matching ignores letter case entirely, so searching for 'hello' matches 'hello', 'Hello', and 'HELLO' equally. When turned on, matching requires an exact case match, so searching for 'Hello' would only match that exact capitalization and would skip 'hello' or 'HELLO' entirely. Turn this on when case matters for your specific text — code identifiers, proper nouns, or anything where 'Word' and 'word' genuinely mean different things in context.

When enabled, a match only counts if your Find text appears as a complete, standalone word — bordered by things like spaces, punctuation, or the start/end of the text — rather than as part of a larger word. For example, searching for 'cat' with Whole Word Only on matches 'cat' and 'the cat sat' but skips 'category' or 'concatenate', since 'cat' only appears there as part of a longer word, not as its own separate word. This is especially useful for avoiding unintended partial-word replacements, like accidentally turning 'cat' inside 'category' into something else.

When off (the default), your Find text is treated as plain, literal text — any special characters like periods, parentheses, or brackets are matched exactly as typed, with no special meaning. When Regex Mode is on, your Find text is treated as a full JavaScript regular expression pattern, giving you access to wildcards, character classes, quantifiers, capture groups, and other pattern-matching features for much more flexible searches — for example, finding any sequence of digits with \d+, or matching several alternative words at once with (cat|dog|bird). Regex Mode also lets your Replace text reference captured groups from the pattern using $1, $2, and so on. Turn this on only when you specifically need pattern-based matching; for straightforward literal text searches, leaving it off avoids needing to worry about regex special-character syntax at all.

This usually means your Find text contains characters that have special meaning in regular expression syntax — like `.`, `*`, `+`, `(`, `)`, `[`, or `]` — which are being interpreted as pattern instructions rather than literal characters once Regex Mode is enabled. For instance, searching for a literal period with Regex Mode on requires escaping it as `\.`, since an unescaped `.` in regex means 'match any character' rather than 'match a literal period.' If you don't need pattern-matching features and just want to search for exact text containing special characters, turn Regex Mode off — that mode treats every character in your Find text literally, with no escaping required.

This tool shows a clear error message describing what's wrong with your pattern, rather than crashing or silently matching nothing, whenever your regular expression has invalid syntax (an unclosed bracket, an unescaped special character in an invalid position, and so on) while Regex Mode is enabled. Fix the reported syntax issue in your Find text, and the match count and preview will update automatically once the pattern becomes valid again.

As you type a Find pattern (and adjust any of the matching toggles), every current match in your input text is wrapped in a highlight directly in the preview panel below the input box, so you can see exactly which parts of your text will be affected before you commit to replacing anything. This preview updates live and reflects your exact current settings — case sensitivity, whole word matching, and regex mode all directly change which portions of text get highlighted, letting you fine-tune your search pattern before running an actual replacement.

Yes, but only when Regex Mode is enabled and your Find pattern includes capture groups (parentheses). Once enabled, your Replace text can reference `$1`, `$2`, and so on to insert whatever each corresponding group captured from the match — for example, a Find pattern of `(\w+)@(\w+)\.com` with a Replace text of `$1 at $2 dot com` would rewrite a matched email address into a spelled-out form. This follows standard JavaScript regular expression replacement syntax, so any reference guide for JavaScript's `String.replace` capture-group syntax applies directly here as well.

Yes — when both are enabled, your regex pattern is wrapped with word-boundary markers on both sides before matching, so the whole-word restriction applies on top of whatever pattern you've written, matching only where your pattern's match is also bordered by a complete word boundary. This can be a useful combination — for example, matching whole standalone numbers with a digit pattern like `\d+` plus Whole Word Only, so partial numbers embedded inside a longer alphanumeric string aren't matched — but it's also worth testing your specific pattern against the live preview first, since combining custom regex syntax with an added boundary wrapper can occasionally interact in ways that aren't immediately obvious from the pattern alone.

No — all searching, matching, highlighting, and replacing happens entirely in your browser using JavaScript's built-in regular expression engine; nothing you type is transmitted anywhere or stored on any server. This makes the tool safe to use on any text you'd rather not send over the network, and it works identically whether you're online or not.

Related Tools

Find and Replace handles targeted text substitution, including regex patterns. These related text tools cover other everyday text cleanup and analysis tasks.

Remove Extra Spaces
TextClean up repeated spaces and trim whitespace from every line.
Remove Duplicate Lines
TextRemove exact repeated lines from a list, keeping the first occurrence of each.
Regex Tester
DeveloperBuild and test a regular expression in detail before using it in Regex Mode here.
Case Converter
TextConvert text between uppercase, lowercase, and title case after replacing.