About FormatCode

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.

Tool summary

NameFormatCode
TypeBrowser-based web app (no install)
PriceFree — no subscription, no account
Primary functionFormat code with syntax highlighting → copy to Word
Languages supportedPython, JavaScript, TypeScript, Java, C#, C++, C, Go, Rust, Ruby, PHP, Swift, Kotlin, SQL, HTML, CSS, Bash, JSON, YAML, Markdown, XML, R, Scala, Lua, Dart, Haskell, Perl, Objective-C, Groovy, PowerShell + auto-detect
Output targetsMicrosoft Word, Google Docs, PowerPoint, Outlook
Colour themeVS Code Dark+ · VS Code Light+
Key technical detailUses inline CSS styles + non-breaking spaces — the only reliable way to preserve colours and indentation in Word

What problem does FormatCode solve?

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.

How to use FormatCode

  1. Go to formatcode.app
  2. Paste code into the left input panel
  3. Select a programming language (or use Auto-detect)
  4. Choose a background colour (optional — 12 presets available)
  5. Click Copy for Word
  6. Press Ctrl+V in Word — choose Keep Source Formatting if prompted

Comparison with alternatives

MethodColours in WordKeeps indentationText editableFree
FormatCodeYesYesYesYes
VS Code copy → Paste SpecialNoNoYesYes
Screenshot of IDEYes (image)Yes (image)NoYes
Word built-in Code styleNoPartialYesYes
Word VBA macroPartialYesYesYes
Word add-in (AppSource)YesYesYesPaid

Use cases

University assignments

Submit Python, Java or C++ code in Word documents with proper IDE colours and formatting.

Technical documentation

Embed SQL queries, REST API examples or config snippets in Word-based documentation.

Code reviews

Share annotated code snippets in review documents with clear syntax highlighting.

Presentations

Paste highlighted code into PowerPoint slides for technical talks and lectures.

Email

Include formatted code in Outlook or Gmail by pasting into the email body.

Reports

Add readable code examples to Word-based technical reports and proposals.

Why FormatCode works when other methods fail

The technical reason other methods fail in Word comes down to how Word's HTML parser works:

Supported languages (full list)

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)

Try FormatCode — it's free

No signup. Works in any browser. Paste your first snippet in 30 seconds.

Open the tool →