Microsoft Word still has no native syntax highlighting in 2025. This guide compares every method available — and tells you which ones are worth using.
| Method | Colours | Indentation | Editable | Speed |
|---|---|---|---|---|
| Screenshot | ✓ | ✓ | ✗ | Fast |
| Word Code Style | ✗ | ~ | ✓ | Medium |
| VBA Macro | ~ | ✓ | ✓ | Slow |
| Word Add-in | ✓ | ✓ | ✓ | Medium |
| IDE Paste Special | ✗ | ✗ | ✓ | Medium |
| FormatCode | ✓ | ✓ | ✓ | Very fast |
Screenshot your IDE and paste the image into Word.
Pros: Quick, accurate colours, no setup.
Cons: Not text — can't be searched or copied. Blurry at print scale. Any update requires a new screenshot.
OK for quick, single-use docsHome → Styles → Code gives you a monospace font — no colours at all.
Not recommended for real documentationWrite a Word macro (Alt+F11) that applies character formatting to code. Several open-source scripts exist.
Cons: Requires enabling macros (security risk), hard to maintain, limited language support, breaks across Word versions.
Viable for IT departments with specific needsA few code highlighting add-ins integrate directly into Word 365.
Cons: Most require paid subscription. Quality and language support varies. Requires Word 365.
Good if you're on Word 365 and paste code dailyVS Code copies rich HTML. In Word: Edit → Paste Special → HTML Format.
Why it fails: VS Code uses CSS classes (.mtk5 { color:#569cd6 }). Word ignores stylesheets — only reads inline style="". Result: no colours. Indentation also collapses because regular spaces are used.
Purpose-built tools that generate Word-compatible HTML with inline styles, non-breaking spaces and solid opaque colours.
Pros: Free, no install, 30+ languages, works with Word, Google Docs, PowerPoint and Outlook.
Best overall — recommended<span class="mtk5"> + stylesheet. Word ignores the stylesheet.<span style="color:#569cd6;"> on every token. Word reads this directly.The indentation difference is the same: VS Code uses regular spaces that Word collapses; FormatCode uses \u00A0 non-breaking spaces that Word preserves as content.
The rule: For code to look correct in Word you need (1) inline style attributes, (2) non-breaking spaces for indentation, and (3) solid hex colours with no opacity. FormatCode generates all three.
Free. No signup. Works for all languages. Try it in 30 seconds.
Open FormatCode →