Code Highlighter
Turn source code into syntax-highlighted HTML you can paste anywhere.
Online Code Highlighter
Plain monospaced code is hard to read. Keywords, strings, comments and function names in different colors let readers understand a snippet at a glance — which is why every IDE highlights syntax. The Code Highlighter brings that to any place that accepts HTML: blog posts, documentation, knowledge bases, presentations, newsletters and README previews. Paste your code, pick the language and theme, and copy the generated markup.
Features
- 22 languages including JavaScript, TypeScript, Python, Java, C#, Go, Rust, PHP, SQL, HTML, CSS, YAML and Bash, plus auto-detection.
- Five themes – GitHub Light, Visual Studio, Monokai, Dracula and Nord.
- Two output styles – self-contained HTML with inline styles, or compact markup with CSS classes and a matching
<style>block. - Optional line numbers that are not copied when readers select the code.
- Live preview of the exact markup you are about to paste.
How to use it
- Paste the snippet or load the sample.
- Choose the language (or Auto-detect) and a theme that matches your site — dark themes look great on slides, light themes on documentation.
- Toggle line numbers for long listings or tutorials that refer to specific lines.
- Copy the HTML or download it, then paste it into your editor's HTML/code view.
Tips for readable snippets
Keep examples short and focused, remove secrets and long tokens, and use comments to explain the important line. Long lines scroll horizontally inside the block instead of wrapping, which preserves indentation. For JSON or XML-specific output, see the JSON Syntax Highlighter and XML Syntax Highlighter; to format code before highlighting it, try the JavaScript Beautifier.
Frequently Asked Questions
Why use inline styles instead of a CSS file?
Inline styles keep the colors attached to the code wherever you paste it: WordPress, Medium, newsletters, Notion exports or email clients that strip style sheets. Choose CSS classes if your site already loads a highlight.js theme or you want smaller markup.
Which languages can be highlighted?
JavaScript, TypeScript, Python, Java, C, C++, C#, PHP, Ruby, Go, Rust, Kotlin, Swift, SQL, HTML/XML, CSS, SCSS, JSON, YAML, Bash and Markdown. Auto-detect picks the best match when you are not sure.
Can I keep line numbers out of copied code?
Line numbers use user-select: none, so readers who copy the code from your page get only the source, without the numbers.
Is my code sent anywhere?
No. Highlighting runs in your browser with the highlight.js engine; nothing is uploaded.