Find and replace formatting in Google Docs (make every match bold, coloured or highlighted)
You want every "Invoice" in a contract in bold, a product name in your brand colour, or each old term replaced by a new one that stands out. Google Docs' Find and replace can't do it: the dialog has exactly two options, Match case and Match using regular expressions, and neither the Find box nor the Replace with box has any formatting setting (Google's help page, checked 1 November 2026; see the sources). Here is what does work, from the fewest clicks to the most matches.
What Docs' own Find and replace can and cannot do
| You want to | Docs' Find and replace (Edit > Find and replace, Ctrl+H) |
|---|---|
| Find a word and replace it with another word | Yes |
| Find text by pattern (regex) | Yes, with "Match using regular expressions" (what works and what doesn't) |
| Make every match bold, italic, coloured or highlighted | No: there is no formatting option in the dialog |
| Replace a word and give the new word a format | No |
| Find all bold (or highlighted, or red) text | No: the Find box searches the text only |
1. A handful of matches: multi-select, then format once
- Press Ctrl+F (Cmd+F on a Mac) and type the word; Docs highlights every match and the arrows jump between them.
- Select the first match with the mouse. Hold Ctrl (Cmd on a Mac) and select the next ones: Docs keeps several selections at once (a feature Google added in May 2022).
- Press Ctrl+B, pick a text colour or a highlight colour from the toolbar: the format applies to all selections together.
To copy a whole look (font, size, colour) from one place to others, select the formatted text, click Paint format (the paint roller in the toolbar), then select the text to change.
If the formatting belongs to headings rather than words, change one heading, then Format > Paragraph styles > Heading 1 > Update 'Heading 1' to match: every heading of that style follows. This works for paragraph styles only, not for single words.
2. Many matches: an Apps Script that bolds every one
Docs has a script editor built in. In your document open Extensions > Apps Script, replace the sample code with the script below, click Save, choose myFunction in the toolbar and click Run. The first run asks you to allow the script to edit your documents. Work on a copy first (File > Make a copy): Ctrl+Z in the document undoes it, but one step at a time.
// Bold every match of a pattern in the document body.
// The pattern is an RE2 regular expression written as a string,
// so a backslash is written twice: '\\bInvoice\\b'.
function boldAll(pattern) {
var body = DocumentApp.getActiveDocument().getBody();
var found = body.findText(pattern);
while (found) {
found.getElement().asText()
.setBold(found.getStartOffset(), found.getEndOffsetInclusive(), true);
found = body.findText(pattern, found);
}
}
function myFunction() {
boldAll('Acme Ltd'); // or boldAll('\\bInvoice\\b') for the whole word only
}
To replace a word and make only the new word bold, add this function and call replaceWithBold('Draft', 'FINAL') from myFunction:
// Replace every match with new text and make only the new text bold.
// All matches are found first, then changed from the last to the first,
// so the offsets stay valid and the new text is never matched again.
function replaceWithBold(pattern, replacement) {
var body = DocumentApp.getActiveDocument().getBody();
var hits = [];
var found = body.findText(pattern);
while (found) {
hits.push(found);
found = body.findText(pattern, found);
}
for (var i = hits.length - 1; i >= 0; i--) {
var text = hits[i].getElement().asText();
var start = hits[i].getStartOffset();
var end = hits[i].getEndOffsetInclusive();
if (replacement) {
text.insertText(end + 1, replacement);
text.setBold(end + 1, end + replacement.length, true);
}
text.deleteText(start, end);
}
}
Other formats work the same way: swap setBold(start, end, true) for setItalic(start, end, true), setUnderline(start, end, true), setForegroundColor(start, end, '#c00000') (text colour), setBackgroundColor(start, end, '#fff2a8') (highlight), setFontSize(start, end, 14) or setLinkUrl(start, end, 'https://example.com').
Limits of the script route:
- It searches the body only. Headers, footers and footnotes are separate parts of the document (
getHeader(),getFooter(),getFootnotes()) and need their own loop. - In a document with tabs,
getBody()is the first tab. For the tab you have open, useDocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(). - The pattern is RE2 and is matched inside each paragraph separately, so a match cannot run across a paragraph break. Google's reference says capture groups and mode modifiers are not fully supported in
findText. - It cannot find text by its formatting ("every bold word") without a longer script that walks each character's attributes.
We tested both functions on 1 November 2026 with node against a small mock of DocumentApp (whole-word matches, untouched text keeps its formatting, a replacement that contains the search word does not loop). We have not yet run them in a live Google Doc; tell us at replacekit@tuper.app if something behaves differently.
3. Find and replace with formatting, no script: ReplaceKit Pro
ReplaceKit is a Google Docs add-on we are building. Its Pro tier adds what the dialog lacks:
- Replace with formatting: the new text gets bold, italic, underline, text colour, highlight, font, size or a link, set in the sidebar.
- Format only: keep the text, change how every match looks (all "Acme Ltd" in brand blue).
- Find by formatting: every bold, highlighted or red run of text, with or without words in the Find box.
- A preview list of every match before anything changes, selection-only mode, and headers, footers and footnotes included.
Free: plain and regex find and replace with no click limit and no trial. Pro ($6/month or $48/year): formatting replace, bulk lists of find => replace pairs, saved rule sets.
ReplaceKit is built and in testing. It is not in the Google Workspace Marketplace yet (Pro formatting replace is not released yet either). Leave your email and we send one message when you can install it.
The free version will have no click limit or trial clock.
More ReplaceKit guides
- Find and replace with a line break or paragraph break in Google Docs
- How to remove line breaks in Google Docs (PDF paste fix)
- Regex find and replace in Google Docs: capture groups and wildcards
- Find and replace in a selection only in Google Docs (and fixes when it is not working)
- Free online tool: remove line breaks from any text (runs in your browser)
Sources
- Google Docs Editors Help: Search and use find and replace (checked 1 Nov 2026: Docs options are "Match case" and "Match using regular expressions"; "Regular expression replacements (including capture groups and special characters like \n for newlines) only work with Google Sheets. In Google Docs, any regex formatting entered into the "Replace with" field will be inserted as literal text."; Google products use RE2)
- Apps Script reference: Body (checked 1 Nov 2026: findText and replaceText use RE2; "A subset of the JavaScript regular expression features are not fully supported, such as capture groups and mode modifiers"; the pattern is matched against each text block separately)
- Apps Script reference: Text (setBold, setForegroundColor, setBackgroundColor, insertText, deleteText)
- Google Workspace Updates: Take action on multiple text selections in Google Docs (May 2022)