HTML to Pug

Convert standard HTML markup into clean, indentation-based Pug (formerly Jade) template syntax for cleaner Node.js development.

// Pug code will appear here...

About the HTML to Pug

Paste HTML and get the equivalent Pug template, where nesting is shown by indentation and tags are written without angle brackets or closing tags.

Everything you enter is processed in your browser; nothing is uploaded or stored.

How to use it

  1. Paste your HTML into Input HTML.
  2. Copy the generated template from Pug Template.
  3. Save it as a .pug file in your Express, Nuxt or static-site project.

How HTML maps to Pug

Pug drops closing tags and angle brackets: <ul><li>Item</li></ul> becomes “ul” with an indented “li Item” under it. Attributes go in brackets – a(href="/about") – and text follows the tag name on the same line.

The converter walks the HTML element tree and writes each element on its own line, indented two spaces deeper than its parent, carrying over its attributes and text.

Example

<div class="card"><h2>Hello World</h2><p>Pug is a template engine.</p></div> becomes div(class="card") h2 Hello World p Pug is a template engine.

Frequently asked questions

Is Pug the same as Jade?

Yes. Jade was renamed Pug in 2016 because of a trademark issue.

Does Pug care about tabs or spaces?

It needs consistent indentation; do not mix tabs and spaces in one file.

Can I convert Pug back to HTML?

Yes, with the Pug to HTML converter.