Code Syntax Highlighter (HTML With Inline Styles)
Colours a code snippet and gives you a pre/code block with inline styles that you can paste into a blog editor, email or CMS without loading a stylesheet or script.
Use the tool
Why this tool exists
Many editors strip classes and scripts but keep inline styles. Highlighting libraries need both. A block with inline colours works in more places.
The highlighter is a small hand-written tokenizer, not a full parser. It colours comments, strings, numbers, keywords and function calls, which is enough for snippets but will misjudge unusual syntax such as nested template strings. The colour pairs in both themes meet normal text contrast against their background.
How to use it
- Paste your code and pick the language.
- Choose a light or dark theme and, if you like, line numbers.
- Check the preview.
- Copy the HTML from the text output.
Frequently asked questions
Why inline styles?
They survive in email clients and CMS editors that remove classes and scripts.
Is the result accessible?
Text stays real text, so screen readers read it normally. Colours are not the only information.
Which languages work?
JavaScript or TypeScript, JSON, Python, C-style languages, CSS, HTML, SQL and shell.
Can it make an image?
Use the Code to Image tool for PNG output.