Skip to content
TextArray
100% local

Swap words

Swap every occurrence of one word with another, and vice versa, in a single pass.

Input
Output

Swap words

Swap words exchanges two words throughout your text at once: every occurrence of the first word becomes the second, and every occurrence of the second becomes the first. Because it works in a single pass, the swap is genuine — "cat dog" turns into "dog cat", never "dog dog". A plain find-and-replace run twice can't do this, since the second pass would overwrite the words the first pass just created.

Type the two words, paste your text, and the result updates as you go. This is exactly what you need when you have mixed up two names in a draft, want to flip "before" and "after" across a whole document, invert "buy" and "sell" in a list of rules, or rename two variables that trade places. The live tally shows how many swaps were made, so you can confirm the change reached every instance.

"Ignore case" is on by default and does two things: it matches regardless of capitalization, and it copies the original word's shape onto the replacement. So "Cat" becomes "Dog", "CAT" becomes "DOG", and "cat" becomes "dog" — sentence starts and headings keep their capitals. Turn it off for an exact, case-sensitive swap. "Whole words only" keeps the match on word boundaries, so swapping "cat" leaves "catalog" untouched; switch it off to swap inside longer words too. Regex characters in your words are treated literally, so "a+" or "c(a)t" are matched as written.

Everything runs in your browser. Your text and the words you type are never uploaded or stored anywhere.

FAQ

How is this different from find and replace?
It swaps both directions at once. Replacing A with B and then B with A separately would turn every A into B and then back, losing the swap. Swap words does it in one pass, so "cat dog" becomes "dog cat".
What does "Ignore case" do to capitals?
It matches any capitalization and mirrors it onto the replacement: all-caps stays all-caps, a capitalized word stays capitalized, and lowercase stays lowercase. Turn it off for an exact, case-sensitive swap.
Why is "catalog" left alone when I swap "cat"?
"Whole words only" is on, so only standalone words match. Switch it off and the tool swaps inside longer words too, turning "catalog" into "dogalog".
Can I use special characters or symbols in the words?
Yes. Characters like +, (, ) or . are treated literally, not as pattern syntax, so "a+" and "c(a)t" swap exactly as typed.
Is my text uploaded anywhere?
No. The swap runs entirely in your browser and neither your text nor the words you enter ever leave your device.