HTML & Markup Converter

Convert HTML, Pug, Jade, JSX, BBCode, and structured data locally in your browser.

What you can convert

Choose a conversion in the menu, paste your source and click Convert. Every conversion runs in your browser; only the Pug/Jade compiler is downloaded from a CDN the first time you need it. Links can open a conversion directly with ?mode=, for example ?mode=html-csv or ?mode=html-pug.

ConversionWhat it does
HTML table to CSV / TSVReads every <tr>, takes the text of each <td> and <th> (tags removed) and writes quoted CSV (RFC 4180 doubling of quotes) or tab-separated rows
HTML table to JSON / YAMLOne object per row. If the first row contains only <th> cells, those become the keys; otherwise keys are column_1, column_2...
HTML to Pug / JadeParses the HTML with the browser's own parser and writes indentation-based Pug: #id.class shorthands, attributes in parentheses, | for text, and script. / style. blocks
Pug / Jade to HTMLCompiles the template with the Jade 1.11 engine and prints indented HTML; syntax errors show the compiler's message
HTML to XML (XHTML)Re-serialises sloppy HTML as well-formed XML: void tags self-closed (<br/>), attributes quoted, entities escaped, then checks the result with an XML parser
TSV to HTML tableFirst row becomes <thead>, the rest <tbody>; short rows are padded so every row has the same cell count
HTML to JSXQuick attribute pass: class to className, for to htmlFor. Inline style strings and void tags still need manual edits
BBCode to HTML / HTML to BBCodeBold, italic and links in either direction. For quotes, images, lists and code use the full BBCode converter
Text to HTMLEscapes < > & ", wraps the text in a paragraph and turns line breaks into <br>
Source code to HTMLEscapes any source (SQL, XML, code) and wraps it in <pre> so it can be pasted into a web page and displayed literally
HTML to PHPWraps the markup in a PHP echo with a correctly escaped string literal

Example: scrape a table into JSON

<table>
  <tr><th>Name</th><th>Age</th></tr>
  <tr><td>Ada</td><td>36</td></tr>
  <tr><td>Alan "T"</td><td>41</td></tr>
</table>

With HTML table to JSON the header row supplies the keys:

[ { "Name": "Ada", "Age": "36" },
  { "Name": "Alan \"T\"", "Age": "41" } ]

and HTML table to CSV gives "Name","Age" / "Ada","36" / "Alan ""T""","41". Values stay strings because HTML has no types; pipe the JSON through the JSON formatter or JSON to CSV if you need more processing. To grab a table from a live page, right-click it, choose Inspect, then Copy > Copy outerHTML on the <table> element.

Example: HTML to Pug

<div id="main" class="card">
  <h1>Hello</h1>
  <p>Read the <a href="/docs">docs</a>.</p>
</div>

becomes

#main.card
  h1 Hello
  p
    | Read the 
    a(href="/docs") docs
    | .

Pug and Jade are the same language: Jade was renamed Pug in 2016, and the syntax this tool writes works with both.

More conversions

These conversions used to have their own small pages; they now live here. Pick one from the menu or use the link in each heading.

HTML to PHP

Turns a block of markup into PHP that prints it. The HTML is put inside one echo with a single-quoted string, so backslashes and single quotes are escaped and $name is printed literally instead of being read as a variable. Useful when you move a static template into a PHP file.

<a href='/cart'>It's here</a>

becomes

<?php
echo '<a href=\'/cart\'>It\'s here</a>';
?>

If you need variables in the output, close the string and join them with a dot, for example echo '<p>' . $name . '</p>';.

SQL to HTML

To show a SQL query (or any code) on a web page, choose Source to HTML. It escapes & < > " and wraps the text in <pre>, so comparisons like price < 10 are not read as tags and the line breaks and indentation stay as written. SELECT * FROM items WHERE price < 10; becomes <pre>SELECT * FROM items WHERE price &lt; 10;</pre>. To turn query results into a table instead, export them as TSV and use TSV to HTML below.

HTML to Jade

Jade is the original name of Pug (renamed in 2016), so HTML to Jade produces the same indentation-based output as HTML to Pug: tag names without angle brackets, #id and .class shorthands, other attributes in parentheses and nested elements indented two spaces. Older projects that still use .jade files can use the output as it is.

<ul class="nav"><li><a href="/">Home</a></li></ul>

becomes

ul.nav
  li
    a(href="/") Home

Jade to HTML

Paste a Jade (or Pug) template and click Convert. The template is compiled by the Jade 1.11 engine in your browser (the compiler is downloaded once from a CDN) and printed as indented HTML. If the template has a syntax error, the compiler's message is shown instead. Templates that use variables need those values at render time; this tool renders without data, so plain markup works best.

HTML table to YAML

Each table row becomes one item in a YAML list. If the first row has only <th> cells they become the keys, otherwise the keys are column_1, column_2 and so on. Values are written as double-quoted strings, so numbers, dates and words like yes keep their exact text. The table in the first example above becomes:

- Name: "Ada"
  Age: "36"
- Name: "Alan \"T\""
  Age: "41"

TSV to HTML table

Paste tab-separated rows, for example cells copied from a spreadsheet. The first row becomes the <thead>, the other rows go in <tbody>, short rows are padded with empty cells and <, > and & are escaped. Name Age / Ada 36 gives a table with the header cells Name and Age and one row, Ada and 36.

HTML table to TSV

Works like HTML to CSV but separates cells with a tab. Every value is wrapped in double quotes (quotes inside a value are doubled), so cells that contain tabs, commas or line breaks stay in one piece. Choose TSV when your data has many commas, such as addresses or prices written as 1,200.

Dedicated converter pages

Some conversions also have their own page with the same tool set to that mode: HTML to JSON, HTML to CSV, HTML to JSX, HTML to Pug, Pug to HTML, HTML to XML, XML to HTML and Text to HTML.

FAQ

Does HTML to CSV handle several tables?

All rows of all tables in the pasted HTML are output one after another. Paste one table at a time if you want separate files.

Are merged cells (colspan/rowspan) supported?

No. Each <td> becomes one value, so rows with merged cells come out shorter. Unmerge the cells first if column alignment matters.

Why does HTML to XML wrap my snippet in <root>?

XML allows only one top-level element. A full document keeps its <html> root; a fragment is wrapped so the output is valid XML.

Is Jade the same as Pug?

Yes. Jade was renamed Pug in 2016 because of a trademark issue. The syntax is the same, so HTML to Jade and HTML to Pug give the same output, and Jade to HTML compiles Pug templates too.

How do I convert HTML to PHP?

Choose HTML to PHP, paste the markup and click Convert. The tool wraps it in a single-quoted PHP echo and escapes backslashes and single quotes, so the page prints exactly the HTML you pasted.

Is my HTML uploaded?

No. All conversions run in your browser.