Word Replacer

Replaces every standalone, whole-word, case-insensitive match of a target word with a replacement word, preserving surrounding punctuation and spacing, unlike a generic find-and-replace that matches any substring. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Replacing a word throughout a document sounds simple until a generic find-and-replace also mangles that word's substring inside unrelated longer words, which is exactly what whole-word matching avoids.

This tool runs entirely client-side, so nothing you paste is ever uploaded to a server.

What Is Word Replacer?

A word replacer that swaps every case-insensitive, whole-word match of a target word for a replacement word, using word-boundary matching so it never touches part of a longer word.

It's distinct from this site's generic find-and-replace tool, which does plain substring replacement and would match a target word anywhere it appears, even inside other words.

How Word Replacer Works

The tool builds a case-insensitive regular expression from the target word wrapped in word-boundary markers, escaping any regex-special characters in the target first.

It then replaces every match in the input with the replacement text, leaving all surrounding punctuation and spacing exactly as it was.

When To Use Word Replacer

Use it when renaming a term throughout a document, swapping a placeholder name for a real one, or correcting a consistently misused word, without risking a partial match inside an unrelated longer word.

It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.

Features

Advantages

  • Whole-word matching avoids accidentally replacing part of a longer, unrelated word.
  • Case-insensitive matching catches capitalized and lowercase occurrences alike.

Limitations

  • The replacement text is inserted verbatim; it doesn't automatically match the original word's capitalization.
  • Only a single target/replacement pair can be set at a time.

Examples

Whole-word replacement

Input

The cat sat on the mat. The category was clear.

Output

The dog sat on the mat. The category was clear.

"cat" is replaced with "dog", but "category" is left untouched since the match is whole-word only.

Best Practices & Notes

Best Practices

  • Check the replacement's capitalization afterward, since it's inserted exactly as typed rather than matched to the original word's case.
  • Use the generic find-and-replace tool instead if you actually want substring matching.

Developer Notes

The target word is escaped for regex special characters and wrapped as `new RegExp(\`\\b${escaped}\\b\`, "gi")`, so `\b` word-boundary assertions are what prevent matches inside longer words like "category".

Word Replacer Use Cases

  • Renaming a term consistently throughout a document
  • Swapping a placeholder name for a real one before publishing
  • Correcting a specific misused word without touching similar longer words

Common Mistakes

  • Reaching for this tool expecting substring matching; use the generic find-and-replace tool for that instead.
  • Assuming the replacement word inherits the matched word's capitalization; it doesn't.

Tips

  • Combine with a word remover tool if you want to replace some occurrences and delete others in separate passes.

References

Frequently Asked Questions