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.
Copiado!
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?
Can it convert Pug back into HTML?
What happens to text mixed with inline tags?
Related Tools
HTML to HAML Converter
Convert HTML into the indented HAML syntax, with no closing tags and shorthand class and id syntax. Paste your HTML and get HAML — great for Ruby on Rails views.
JSX to HTML Converter
Converts JSX (React) syntax to plain HTML by mapping className to class and camelCase attributes to kebab-case.
AsciiDoc → HTML (basic)
Render simple AsciiDoc to HTML: headings = == ===, paragraphs, lists, emphasis. Does not cover advanced extensions like includes.
HTML to JSX
Convert HTML to React JSX automatically. Transforms class→className, for→htmlFor, converts attributes to camelCase and closes void tags.
Date Format Converter
Convert dates between the most common formats: dd/mm/yyyy, yyyy-mm-dd, mm/dd/yyyy, ISO 8601 and Unix timestamp.
In-Text Unit Converter (Imperial ↔ Metric)
Rewrites every measurement inside a block of text between imperial and metric units, handling fractions, inches, pounds, cups and Fahrenheit.