Code to HTML
Paste source code, get syntax-highlighted HTML with inline styles. Ready for any blog, CMS, or email — no stylesheet required.
Your code
Runs entirely in your browser. Nothing is uploaded.
Preview
HTML output
What this code to HTML converter does
Paste a snippet, choose a language and theme, and this syntax highlighter turns it into finished HTML. Highlighting is done with Shiki, the same TextMate grammar engine that powers VS Code, so the colors match what you see in your editor rather than an approximation from a regex-based highlighter.
The important part is what comes out: every token carries its color as
an inline style attribute. There is no class name to map,
no theme file to upload, and no JavaScript for your readers to
download. It is a self-contained block of markup.
How to use the output
WordPress
Add a Custom HTML block (or switch the block editor to the code editor view), paste the markup, and preview. Because the styling is inline, the snippet looks the same after a theme change and does not need a highlighting plugin.
Ghost, Notion-style CMSs, and static sites
Use an HTML card in Ghost, or paste directly into any Markdown file — Markdown passes raw HTML straight through. For newsletters, paste into the HTML source of your email builder.
Email clients routinely strip <style> blocks and
ignore external stylesheets, which is exactly why inline styles matter
here. Turn line numbers off for email, since narrow mobile widths leave
less room for a gutter.
Why inline-style HTML needs no stylesheet
A traditional highlighter emits class names like
.token.keyword and expects a matching stylesheet to be
loaded. If that stylesheet is missing, blocked, or overridden by a CMS
theme, your code renders as flat grey text. Inline styles have the
highest specificity of any author style short of
!important, so the snippet keeps its colors wherever it
lands. The trade-off is slightly larger markup — a fair price for
a snippet that never breaks.
Frequently asked questions
Does the generated HTML need a CSS file?
No. Every color is written as an inline style attribute on the markup itself, so the snippet renders identically wherever you paste it — even in places that strip <style> blocks, like most email clients.
Will this work in WordPress or Ghost?
Yes. In WordPress use a Custom HTML block; in Ghost use an HTML card. Paste the generated markup, publish, and the highlighting survives because it does not depend on your theme stylesheet.
Is my code uploaded anywhere?
Never. Highlighting runs entirely in your browser using the Shiki engine loaded on this page. Nothing is sent to a server, so it is safe for private or client code.
Can readers still copy the code from my post?
Yes. The output is real text inside a <pre><code> element, not an image, so it stays selectable, searchable, and screen-reader friendly. Line numbers are marked user-select: none so they are skipped when readers copy.