Skip to content

Syntax Highlighter

Colorful code for blogs and docs.

Runs in your browser · free · no sign-up

1

About the Syntax Highlighter

Paste code to get it colored for blog posts, documentation or slides. Copy the highlighted HTML with inline styles so it looks the same anywhere you paste it.

Code in blog posts, documentation, slides and emails is far easier to read when keywords, strings and comments are coloured. Many platforms either do not highlight code or need plug-ins. This tool produces highlighted code with inline styles, so the colours travel with the code wherever you paste it.

Paste code, choose one of more than 30 languages or let the tool detect it, pick a light or dark theme and turn line numbers on or off. Copy as HTML for websites and CMS editors, or copy as rich text to paste coloured code straight into Word, Google Docs, PowerPoint or email. Highlighting is powered by highlight.js, a widely used open-source library.

Rich-text copying places the coloured code on your clipboard in the same format word processors use, so pasting into Google Docs or PowerPoint keeps fonts and colours without any extra steps.

How to use the Syntax Highlighter

  1. 1Paste your code and pick the language (or Auto).
  2. 2Choose a theme and line numbers.
  3. 3Copy as HTML or rich text.

Key features

  • 30+ languages with auto-detection.
  • Light and dark themes.
  • Optional line numbers.
  • Copy as HTML with inline styles.
  • Copy as rich text for documents and slides.

Practical uses

  • Adding code to WordPress posts without a plug-in.
  • Putting coloured code in presentation slides.
  • Sharing code in emails or Google Docs.
  • Preparing teaching materials.
  • Creating code screenshots for social media posts.

Example

A short Python function pasted with the Dark theme shows keywords such as def and return, strings and comments in distinct colours. Copy as rich text and paste into a PowerPoint slide to keep the colours.

Tips and common mistakes

  • Choose the language manually for short snippets to avoid wrong detection.
  • Use the light theme for printed documents.
  • Keep code snippets short in slides; highlight only the lines that matter.
  • Turn off line numbers when readers are likely to copy the code, so numbers are not copied too.

Limitations

  • Very rare languages are not included.
  • Some email clients strip background colours.

Privacy

Highlighting happens in your browser.

Frequently asked questions

Which languages are supported?

Over 30 common languages including JavaScript, Python, PHP, Java, C#, Go, SQL, Bash, HTML and CSS.

Will the colors work in WordPress or email?

Yes. "Copy as HTML" uses inline styles, so no extra CSS is needed.

Which engine is used?

highlight.js, an open-source syntax highlighter.

Why use inline styles?

Inline styles keep colours when pasted into places that do not load extra CSS, such as emails and CMS editors.

Can I change the font?

The output uses a monospace font. You can change it in your document after pasting.

Related tools

JavaScript MinifierMinify and compress JavaScript with Terser.
Code BeautifierFormat JavaScript, CSS, HTML and JSON.
Code Diff ViewerCompare two code versions line by line.