what it is
Markdown to self-contained HTML, decorated and real.
fenced is a free, browser-based converter that turns Markdown into clean, self-contained HTML. Every fenced code block is rendered as a decorated window with proper syntax highlighting, and the result stays real, selectable HTML you can copy, host, or paste anywhere. No screenshots, no image exports, no account.
Screenshots of code go stale the moment you edit, cannot be copied, ignore dark mode, and read poorly on a phone. fenced keeps your code as text and just dresses it up, so it stays accessible to readers, screen readers, and search engines.
It runs the other way too. Flip one toggle and fenced becomes an HTML to Markdown converter that brings code blocks home as real fences, language and all.
how it works
Three ways to dress a fence.
Paste or drop a Markdown file, pick a look, then copy the HTML or download a single self-contained file. Every code block resolves to one of three modes:
- Terminal. A window with traffic-light chrome and a language label, the signature look.
- Themed. A clean syntax-highlighted card with line numbers.
- Plain. Minimal chrome, no highlighting, just the code.
Highlighting is powered by Shiki, with the four Catppuccin flavors plus GitHub, One Dark Pro, Nord, Dracula, Tokyo Night, and more. Tokens ship as inline styles, so an exported file needs no stylesheet, just the markup.
the other direction
It runs both ways.
Flip the convert toggle and fenced runs backwards: paste rendered HTML, get clean Markdown out. The whole point is code blocks, which is the one thing generic HTML to Markdown converters get wrong.
fenced digs the language back out of whatever the source used to mark it up, a language-x class, GitHub's highlight-source-x, a data-lang attribute, or one of its own exports, and writes a real fenced code block with the language on it. Window chrome, "Copy code" buttons, and line-number gutters get dropped rather than flattened into your code.
Pasting is the way in. Copying from a rendered page puts a rich HTML flavour on the clipboard, so you can copy an article straight off a blog, a docs site, or your notes app and paste Markdown out, with no view-source detour. Tables, task lists, and strikethrough come across as GitHub Flavored Markdown.
where it fits
Built for blogs, docs, and email.
Because the output is portable HTML with inline styles, a fenced block drops cleanly into a blog post, a CMS like Ghost or WordPress, static-site documentation, or even an email newsletter, where most highlighted-code tools fall apart. Copy a single block, or convert a whole document at once.
faq
Questions, answers.
- Does fenced upload my Markdown or code?
- No. Everything runs in your browser. Parsing and syntax highlighting happen on your device, and nothing is ever uploaded or sent to a server.
- How is fenced different from a code screenshot tool like Carbon or ray.so?
- Those tools export an image. fenced outputs real, selectable HTML, so readers can copy your code, it stays sharp on any screen, and it remains readable by screen readers and search engines. No screenshots.
- Is the exported HTML self-contained?
- Yes. Syntax colors are inlined on each token and the styles are bundled into the file, so a downloaded .html works anywhere with no external stylesheet. You can also lift a single decorated code block into a CMS or an email.
- Can I use the output in an email newsletter?
- Yes. Because the syntax colors are inline styles, the decorated code blocks render in email clients that strip external CSS, which most highlighted-code tools cannot do.
- Can fenced convert HTML back to Markdown?
- Yes. Flip the convert toggle at the top and fenced runs in reverse: paste rendered HTML and get clean Markdown out. It runs in your browser like everything else, so the HTML you paste is never uploaded either.
- Does the HTML to Markdown converter keep code blocks?
- Yes, and that is the point of it. fenced recovers the language from the markup, whether that is a
language-class, adata-langattribute, GitHub'shighlight-source-class, or one of its own exports, and writes a real fenced code block with the language on it. Window chrome and copy buttons are dropped rather than flattened into the code. - Is anything lost converting HTML to Markdown?
- Syntax colours, because they are HTML and Markdown has no way to say them. Layout-only markup goes too. A table with merged cells is left as HTML rather than flattened, since a lossy table is worse than none. A file exported from fenced converts back to its original Markdown exactly.
- Which languages and themes are supported?
- Highlighting is powered by Shiki, with languages including TypeScript, Python, Rust, Go, and many more, and themes including all four Catppuccin flavors plus GitHub, One Dark Pro, Nord, Dracula, Tokyo Night, and others.
- Is fenced free and open source?
- Yes. fenced is free and MIT licensed, and the source is available on GitHub.