FormatterHQ

Jade to HTML: Render and Migrate Old .jade Templates

Compile the static parts of legacy .jade files from Jade to HTML in the browser, and spot the old syntax that needs fixing before a migration.

Input TEXT
Output HTML
Ready.

How to use the Jade to HTML Converter

  1. Open a .jade file or paste the template.
  2. Replace variables, loops and includes with sample static content.
  3. Change !!! 5 or doctype 5 to doctype html (this compiler still accepts the old form; Pug does not) and add a dot after script tags that hold code.
  4. Compile and compare the HTML with the page your app renders.
  5. Copy the HTML, or keep the cleaned template for a move to Pug.

Jade to HTML for templates you inherited

Old Express projects often keep their views in .jade files, written for a package that was deprecated when Jade became Pug. Rendering them normally means installing that outdated dependency and running the whole application with its data. This Jade to HTML page takes a shortcut for the static parts: open a .jade file, compile it in the browser and read the markup it produces, so you can extract it, document it or plan a migration.

It uses the same compiler as the Pug to HTML compiler. For current .pug files, that page is the better reference because it covers modern Pug syntax in depth. Use this one when you are dealing with legacy Jade and need to know which old constructs will cause trouble.

Example: an old dashboard view

doctype html
html
  head
    title Legacy dashboard
    script.
      window.appVersion = "1.4";
  body
    #main.container
      h1 Reports
      p
        | Last export:
        em  none yet
      a.btn(href="/reports/new", title="New report") Create report
      // shown in the output
      //- hidden note

With pretty printing on, the result is:

<!DOCTYPE html>
<html>
  <head>
    <title>Legacy dashboard</title>
    <script>
      window.appVersion = "1.4";
    </script>
  </head>
  <body>
    <div class="container" id="main">
      <h1>Reports</h1>
      <p>Last export:<em> none yet</em></p><a class="btn" href="/reports/new" title="New report">Create report</a><!-- shown in the output-->
    </div>
  </body>
</html>

The // comment is kept as an HTML comment and the //- comment disappears. The space before "none yet" comes from the extra space after em, a common trick in old templates for spacing inline elements.

Legacy Jade syntax to check before you compile

Found in old templatesWhat this compiler doesWhat to change
!!! on its ownWrites <!DOCTYPE html>Nothing here; use doctype html if the file will move to Pug, which no longer accepts !!!
!!! 5 or doctype 5Writes <!DOCTYPE html> (the old Jade shorthand for HTML5)Use doctype html if the file will move to Pug
a(href="/u/#{id}")Copies /u/#{id} into the attribute literallyUse a sample value here; in Pug, write a(href="/u/" + id)
script with code indented below it, no dotReads each line as a tag: var x = 1; becomes <var>x = 1;</var>Write script. with a trailing dot
- var, each, if, mixin, +call, include, extends, blockStops with an error naming the lineReplace with static sample markup, or render inside the real app

The script case deserves attention because it does not raise an error: the output looks plausible until you notice the stray tags. Search old files for script and style lines without a trailing dot before trusting the result.

A practical migration workflow

  1. Copy one view and swap every variable, loop and include for representative static content, so the file compiles on its own.
  2. Fix the legacy forms from the table above: doctype line, dotless script blocks and interpolated attributes.
  3. Compile here and compare the HTML with what the running application serves for the same page.
  4. Decide the destination. To stay on the engine, rename the file to .pug and switch the project from jade to pug. To leave it, keep the compiled HTML, or turn it into components with the HTML to JSX converter.

New fragments for a project that remains on Jade can go the other way with the HTML to Jade converter. To see exactly what changed between the old and the cleaned-up template, paste both into the diff checker.

Reading the compiled output

  • Pretty print – on by default and indents the HTML. Switch it off for compact markup without added whitespace.
  • Boolean attributes – when the template starts with doctype html, input(disabled) becomes <input disabled>. Without that doctype line it becomes <input disabled="disabled"/>, the XHTML style. Add the doctype if you want HTML5 output.
  • Literal output – lines such as p= "Welcome" with a quoted string compile; expressions that reference variables do not.
  • Files – both .jade and .pug files can be opened directly into the editor.

Compilation runs in your browser, so templates are not sent to a server.

Frequently asked questions

Does the compiler accept !!! 5 and doctype 5?
Yes. Both are read as the old Jade shorthand for the HTML5 doctype and produce . Pug no longer accepts !!! or the 5 shorthand, so change the line to doctype html if the template will move to Pug.
Why did my script code turn into tags?
Script content must follow script. with a trailing dot. Without the dot, each indented line is read as a tag, so var x = 1; becomes <var>x = 1;</var>.
What happens to #{id} inside an attribute value?
It is copied into the HTML literally. Attribute values are treated as plain strings, as in current Pug, so replace the placeholder with a sample value before compiling.
Can I render templates that use extends, include or mixins?
No. Those need the other template files and your data, so compiling stops with the line number. Inline the parts you need or replace them with static markup first.
Is this different from the Pug to HTML compiler?
The compiler is the same. This page focuses on older .jade files and the syntax they typically contain; the Pug page covers current Pug templates.

Last updated September 27, 2026

Related tools

HTML to Jade Converter Turn HTML into Jade syntax for legacy .jade views, using only markup that also keeps working after an upgrade to Pug. BBCode to HTML Converter Convert forum BBCode such as [b], [url], [quote], [list] and [code] into clean, safe HTML markup instantly. CSV to HTML Table Converter Convert CSV to HTML online for free. Get clean table markup with a live preview. Excel to HTML Table Converter Convert Excel to HTML online for free. Get clean table markup with a live preview. HTML Entities to Text Turn HTML entities (named, decimal and hex) back into plain Unicode text. HTML to BBCode Converter Convert HTML into forum-friendly BBCode: bold, links, images, lists, quotes, tables, code blocks and inline colours. Mailto Link Generator Create mailto: links with pre-filled recipients, CC, BCC, subject and body — correctly URL-encoded, with the HTML <a> tag. Marquee Generator Generate HTML marquee code for scrolling text with direction, speed, behaviour, colours and pause-on-hover, with live preview. HTML Minifier Minify HTML online including inline CSS and JavaScript. Pug to HTML Converter Compile Pug templates to HTML online: tags, #id/.class shortcuts, attributes, block text, interpolation and comments. Responsive Website Tester Preview any website on phone, tablet, laptop and desktop screen sizes side by side to check your responsive design. Text to HTML Converter Paste formatted text from Word, Google Docs or a web page, or type plain text, and get clean HTML code. Removes inline styles, classes and Word markup.