Pug to HTML Compiler
Paste Pug (Jade) template code and instantly compile it to clean, formatted HTML
Paste any Pug (Jade) template and get the compiled HTML in one click — no Node.js install, no build tools, no command line. Tags, classes, IDs, attributes, nesting, doctypes, and comments all convert correctly. And everything runs in your browser. Nothing gets uploaded.
How It Works
The compiler reads each line of your Pug template, tracks indentation depth to figure out parent-child relationships, then builds the matching HTML tree. It resolves shorthand — dots for classes, hashes for IDs, parentheses for attributes — and outputs properly nested markup with your chosen indent size.
Examples
Basic Page Structure
Starting a new HTML page from a Pug skeleton.
doctype html
html(lang='en')
head
title My Page
body
h1 Hello World
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
Navigation with Classes and IDs
You need to convert a nav component that uses Pug’s shorthand for classes and IDs into the HTML a designer can drop into Figma or a static mockup.
nav#main-nav.navbar
ul.nav-list
li.nav-item
a(href='/') Home
li.nav-item
a(href='/about') About
li.nav-item.active
a(href='/contact') Contact
<nav id="main-nav" class="navbar">
<ul class="nav-list">
<li class="nav-item">
<a href="/">Home</a>
</li>
<li class="nav-item">
<a href="/about">About</a>
</li>
<li class="nav-item active">
<a href="/contact">Contact</a>
</li>
</ul>
</nav>
Form with Attributes and Self-Closing Tags
Converting a signup form — this one shows how Pug handles multiple attributes in parentheses and void elements like input and br.
form(action='/signup' method='POST')
label(for='email') Email
br
input(type='email' id='email' name='email' required)
br
label(for='pass') Password
br
input(type='password' id='pass' name='pass')
br
button(type='submit') Sign Up
<form action="/signup" method="POST">
<label for="email">Email</label>
<br>
<input type="email" id="email" name="email" required>
<br>
<label for="pass">Password</label>
<br>
<input type="password" id="pass" name="pass">
<br>
<button type="submit">Sign Up</button>
</form>
Who Uses This
Quick-checking Pug output without spinning up a Node server or build pipeline.
Learning Pug syntax by seeing the HTML result in real time — great for grasping how indentation maps to nesting.
Debugging Express.js views by isolating whether a rendering bug is in the template or the server logic.
Converting Pug snippets from docs into HTML for code samples that readers can copy-paste directly.
Common Mistakes
Pug treats tabs and spaces as different characters. If you indent some lines with tabs and others with spaces, the nesting breaks and you’ll get garbled output. Pick one — spaces are safer — and stick with it.
One extra or missing space changes which element is the parent. A li indented 3 spaces under a ul that uses 2-space indentation? That’s an error, not a child element. Match your indent width consistently.
Writing div Hello then indenting children under it creates a conflict. If a tag has nested children, put the text on a separate piped line (| Hello) instead.
This is a static compiler. Things like each item in list, JavaScript expressions inside #{}, or include header.pug need a full Node.js Pug runtime. The tool handles structural Pug — tags, classes, attributes, nesting — not server-side logic.
Technical Details
- Processing: 100% client-side — nothing is uploaded
- Browser Support: Chrome, Firefox, Safari, Edge
- Output Formats: HTML5 or XHTML doctype
- Indent Options: 2 or 4 spaces, with pretty-print toggle
- Offline: Works without an internet connection
Frequently Asked Questions
What is Pug and how is it different from HTML?
Pug is a template language that compiles down to HTML. Instead of writing opening and closing tags, you write tag names with indentation to show nesting. So div followed by an indented p Hello becomes <div><p>Hello</p></div>. It is faster to write and easier to scan once you’re used to it.
Is Pug the same as Jade?
Yes. Jade was renamed to Pug in 2016 because of a trademark issue. The syntax didn’t change. If you see old tutorials referencing Jade, they still apply — just the package name is different on npm.
Can I convert HTML back to Pug?
This tool goes one direction — Pug to HTML. For the reverse, you’d need an HTML-to-Pug converter (sometimes called html2jade). We have an HTML to Pug tool that handles that.
Why doesn’t my each loop or if statement work?
Control flow (each, if, else, case) and JavaScript expressions need a full Pug runtime running on Node.js. This browser-based compiler handles the static parts of Pug — tags, attributes, nesting, comments, and doctypes. For dynamic features, you’ll need to run Pug through Node or a build tool like Webpack.
Is my Pug code sent to a server?
No. The entire compilation happens in your browser’s JavaScript engine. Nothing gets uploaded, stored, or logged. You can disconnect from the internet and it’ll still work — try it.