HTML to Pug
Paste HTML markup below.
Paste HTML and convert it into Pug template syntax with proper indentation. IDs become #id shorthand, classes become .class shorthand, attributes are preserved and text content is inlined.
Paste HTML markup below.
Your HTML is parsed into a DOM-like tree, then each element is emitted as a Pug line: the tag name, #id and .class shorthands, remaining attributes in parentheses, and child elements indented by two spaces. Text-only elements are inlined after the tag, and mixed content uses the pipe syntax.
Pug removes closing tags and angle brackets, which makes deeply nested layouts dramatically shorter. Converting an existing HTML snippet is the fastest way to try Pug in an Express or static site project without rewriting markup by hand.