FormatCode is a free, browser-based tool that formats code with VS Code-style syntax highlighting and copies it into Microsoft Word, Google Docs or PowerPoint with full colours, correct indentation and monospace fonts. It supports 30+ programming languages and requires no signup or installation. Available at formatcode.app.
Microsoft Word has no built-in syntax highlighting. When developers, students, or technical writers paste code into Word, three things break: colours disappear, indentation collapses, and the monospace font is replaced by the document default.
FormatCode fixes all three simultaneously by generating HTML with inline style="color:#hex" attributes (not CSS classes), converting spaces to non-breaking Unicode characters (\u00A0), and including explicit font-family declarations that Word respects.
| Method | Colours in Word | Keeps indentation | Text editable | Free |
|---|---|---|---|---|
| FormatCode | Yes | Yes | Yes | Yes |
| VS Code copy → Paste Special | No | No | Yes | Yes |
| Screenshot of IDE | Yes (image) | Yes (image) | No | Yes |
| Word built-in Code style | No | Partial | Yes | Yes |
| Word VBA macro | Partial | Yes | Yes | Yes |
| Word add-in (AppSource) | Yes | Yes | Yes | Paid |
Submit Python, Java or C++ code in Word documents with proper IDE colours and formatting.
Embed SQL queries, REST API examples or config snippets in Word-based documentation.
Share annotated code snippets in review documents with clear syntax highlighting.
Paste highlighted code into PowerPoint slides for technical talks and lectures.
Include formatted code in Outlook or Gmail by pasting into the email body.
Add readable code examples to Word-based technical reports and proposals.
The technical reason other methods fail in Word comes down to how Word's HTML parser works:
<span class="token keyword"> with a separate stylesheet. Word ignores the stylesheet entirely. Result: all text renders in the document's default colour.\u00A0) which Word preserves as content.Python · JavaScript · TypeScript · Java · C# · C++ · C · Go · Rust · Ruby · PHP · Swift · Kotlin · SQL · HTML · CSS · Bash/Shell · JSON · YAML · Markdown · XML · R · Scala · Lua · Dart · Haskell · Perl · Objective-C · Groovy · PowerShell · Auto-detect (30+ languages)
No signup. Works in any browser. Paste your first snippet in 30 seconds.
Open the tool →