Pug to HTML Converter
Paste Pug (Jade) template code and get the equivalent HTML — indentation, selectors, attributes, and void tags are all handled automatically.
Last updated: May 26, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Pug to HTML Converter?
Pug (formerly Jade) is a template engine for Node.js that uses indentation instead of closing tags. A line like `.card` becomes `<div class="card">`, and the elements indented below it become its children. The result is markup that is much more concise than HTML.
This converter implements a Pug-to-HTML parser entirely in the browser. It parses each line to extract the tag, id, classes, and attributes, then uses indentation to track parent-child relationships. Void elements (`<img>`, `<br>`, `<input>`) are emitted without closing tags. Block literals (tag followed by `.` and indented content) are preserved verbatim.
This is a structural converter — it handles static Pug markup, not the template features like mixins, conditionals, loops, or variable interpolation. For those, use the official Pug CLI.
How to Use Pug to HTML Converter
Paste Pug template code into the input panel.
The HTML equivalent appears instantly on the right.
Click Copy or Download .html to use the result.
Common Use Cases
- Migrating a Pug-based project to a plain HTML setup.
- Compiling Pug snippets to HTML for inclusion in a non-Pug environment.
- Learning HTML by seeing how Pug templates translate to markup.
- Generating an HTML mock from a designer's Pug deliverable.
- Cross-checking the HTML output of a Pug template without running the Pug CLI.
Example Input and Output
A Pug card component expands to a div with class, an h2, and an anchor.
.card
h2#title Hello
a.btn(href='/') Go home<div class="card">
<h2 id="title">Hello</h2>
<a class="btn" href="/">Go home</a>
</div>Privacy
All conversion happens in your browser. No Pug or HTML is sent to a server.
Indentation
Use spaces consistently for indentation. Tabs are interpreted as 4 spaces. Mixed indentation may produce unexpected nesting.
Frequently Asked Questions
Are mixins and variables supported?
No. This converter handles static Pug markup only. Mixins, conditionals (if/each/case), variable interpolation (#{var}), and includes are not processed.
What happens with the doctype?
doctype html becomes <!DOCTYPE html>. Other shortcuts (doctype xml, doctype transitional, etc.) emit a generic <!DOCTYPE X> with the value passed through.
How are comments handled?
// comment becomes <!-- comment -->. //- silent comment is dropped from the output, matching standard Pug behaviour.
What is a block literal?
Pug allows tag. (with a trailing dot) followed by indented content that is preserved verbatim. This is typically used for <style>, <script>, or <pre> blocks where you do not want Pug to parse the content.
Related Tools
HTML to Pug Converter
Convert HTML markup to Pug (formerly Jade) template syntax. Handles selectors, attributes, nested elements, void tags, and full documents with doctype.
HTML Beautifier
Format and beautify minified or messy HTML code.
HTML Minifier
Compress HTML by removing whitespace, comments, and redundant attributes — with size reduction stats.
Markdown to HTML Converter
Convert Markdown to clean, semantic HTML with live preview — GFM tables and task lists, heading IDs, a table of contents generator, four output modes, and HTML sanitization.
HTML to Markdown Converter
Convert HTML into clean, readable Markdown — preserving headings, links, images, lists, and tables.
HTML to JSX Converter
Convert HTML to JSX for React — converts class to className, for to htmlFor, self-closes void elements, and converts inline styles to JSX objects.

