1001Ferramentas
🔄Converters

HTML to Pug Converter

Convert HTML into the indentation-based Pug (formerly Jade) syntax, with no closing tags. Paste your HTML and get the Pug version — great for Node.js and Express.

Para HTML bem-formado. Não cobre <script>/<style> com conteúdo nem tags mal-fechadas.

Cada tag HTML vira o nome do elemento sem <>, e o aninhamento é feito por indentação.

<ul><li>Item</li></ul>ul\n li Item

Atributos: <a href="/x">a(href="/x"). Classes: div.classe. IDs: div#meu-id.

From closing tags to Pug indentation

You joined an Express project that renders Pug and someone handed you a chunk of plain HTML: a Bootstrap card, a landing page section, the footer of the old site. Rewriting it by hand means deleting every closing tag and counting indentation line by line, and two stray spaces are enough to wreck the layout. Paste the HTML on one side and the Pug shows up on the other as you type.

The conversion runs on a small custom parser, not the browser DOM. The id and classes come out in shorthand (div#c1.card.active), other attributes go inside parentheses, and void tags like img, br and input never open a block. An element holding only text stays on one line (h2 Hi); mixed text and tags become piped lines. One catch: the DOCTYPE line is not turned into doctype html, it lands as plain text for you to delete.

Close every tag before pasting. A list item left without its closing tag is valid HTML, but here the next item ends up nested inside the previous one. Script and style blocks with content do not survive either, as the note under the field says. Vue and Alpine attributes lose their prefix: @click becomes click and :class is read as a plain class. Nothing leaves your browser, the pasted markup is never uploaded.

Frequently asked questions

Are Pug and Jade the same language?
They are. The project was called Jade and got renamed in 2016 over a trademark clash. The basic syntax this page emits works the same in both.
Can it convert Pug back into HTML?
Not on this page, the conversion goes one way only. For the reverse, use the official compiler with npx pug file.pug.
What happens to text mixed with inline tags?
It gets split into separate lines, one per fragment. In tight phrases, like a price with the number wrapped in strong, that changes the rendered spacing, so review the output before committing.

Related Tools