Web & Developer Utilities100% Client-Side

HTML to Pug Converter

Paste a short HTML fragment to get a first draft in Pug’s indentation-based syntax. The converter reads common tags and turns double-quoted IDs and classes into shorthand. Use the result when moving a small layout into a Pug template or learning how the same structure looks in both formats. Review the draft for other attributes, nested inline elements, and cases where line breaks are meaningful before using it in a project.

Input
95 chars•1 lines
Output

Reverse tool

Pug to HTML

Expand simple Pug tag lines into HTML with IDs, classes, and inline text. Inspect shorthand or prepare a fragment for editing directly in your browser.

Open Pug to HTML

How to Use the HTML to Pug Online

  1. 1Paste a small fragment with explicit opening and closing tags. Start with one component or section so the result is easy to inspect.
  2. 2Check how the converter represents IDs and classes. Double-quoted values can become hash and dot shorthand on the tag line.
  3. 3Compare the resulting indentation with the original parent and child elements. Restore attributes and inline markup that the draft did not carry over.
  4. 4Try the reviewed draft in your project’s Pug renderer and compare the generated HTML with the source fragment.

Input & Output Examples

The section’s ID and both classes become shorthand. The heading and paragraph appear on indented lines.

Input Sample
<section id="news" class="panel wide"><h2>News</h2><p>Latest updates</p></section>
Expected Output
section#news.panel.wide
  h2 News
  p Latest updates

The list has a class in shorthand form and its two child items share the same indentation.

Input Sample
<ul class="links"><li>Docs</li><li>Support</li></ul>
Expected Output
ul.links
  li Docs
  li Support

Practical Developer Workflows

  • Draft a Pug version of a small static component while keeping the original HTML available for comparison.
  • Show how a plain container, heading, and paragraph are expressed in an indentation-based template language.
  • Convert the outline of a fixture before adding Pug-specific variables, attributes, or other expressions in the project.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

The converter recognizes double-quoted id and class attributes and represents them in shorthand. Review other attributes such as href, src, alt, data attributes, and form settings in the source. Add them to the Pug draft explicitly when the template needs them.

Explore Other Tools

12 suggested tools

View all tools