- Paste your HTML code into the input editor.
- In the options panel, select your desired indentation style (e.g., 2 spaces, 4 spaces, or tabs).
- Choose whether to use single or double quotes for attributes.
- The equivalent Jade/Pug code is automatically generated in the output editor.
- Copy the converted code for use in your project.
HTML to Jade Converter
Convert HTML (HyperText Markup Language) into Jade/Pug template syntax with configurable formatting options.
HTML input
Paste HTML markup. The conversion runs in your browser.
Options
Match your project’s indentation and attribute quote style.
Jade / Pug output
Paste HTML to generate output.
Start typing on the left — output will update automatically.
How to Use This Tool
Learn More About HTML to Jade Converter
What is Jade/Pug?
Pug (formerly Jade) is a high-performance template engine implemented with JavaScript for Node.js and browsers. It provides a clean, whitespace-sensitive syntax for writing HTML, which can significantly reduce the verbosity of your code. Pug's key features include an indentation-based hierarchy that eliminates the need for closing tags, and attributes defined inside parentheses. It also supports powerful logic like variables, loops, conditional statements, and mixins (reusable blocks of code), making it an excellent choice for building dynamic web applications.
Key Differences Between HTML and Pug
- Tags: HTML uses opening and closing tags (e.g.,
<p>...</p>), while Pug omits closing tags and uses indentation to define structure. - Nesting: HTML nests elements within parent tags. Pug uses indentation to define the same hierarchy, resulting in cleaner code.
- Attributes: In HTML, attributes are written inside the opening tag (
<div class="container">). In Pug, they are placed in parentheses after the tag (div(class='container')). Pug also offers shortcuts for classes (.container) and IDs (#main). - Text: To add plain text in HTML, you place it between tags. In Pug, you place it after a tag and a space, or on a new indented line for block-level text.
The Origin of Jade (Pug)
- Creator
- TJ Holowaychuk
- Initial Name
- Jade
- Influenced By
- Haml
- Primary Ecosystem
- Node.js
Examples
Convert a Basic HTML Document
An HTML5 boilerplate document is pasted into the input field. The user selects '2 spaces' for indentation and 'double quotes' for attributes.
The equivalent Pug code is generated, showing the `doctype html`, `html`, `head`, and `body` structure with proper indentation and attributes enclosed in parentheses.
Convert an HTML Form with Single Quotes
An HTML `<form>` with `<label>`, `<input>`, and `<button>` tags is provided. The output is configured to use '4 spaces' for indentation and 'single quotes' for attributes.
A nested Pug representation of the form is generated, where attributes like `type`, `name`, and `for` are enclosed in single quotes.
Convert Nested Layout with Tab Indentation
Observe how nested <div> elements with classes and IDs are simplified using Pug's syntax and tabbed indentation.
HTML containing several nested `<div>` elements with `id` and `class` attributes is provided. 'Tabs' is selected as the indentation style.
The corresponding Pug code uses concise `.class` and `#id` syntax, with the element hierarchy defined by tab-based indentation.
Use Cases
- Migrating existing HTML templates into Pug/Jade.
- Generating a starting point for Pug views from static HTML.
- Standardizing indentation and attribute quotes across templates.