HTML Cleaner & Formatter

Output mode:

Ever pasted some HTML out of a CMS, page builder or even Word? If you have, then you know exactly how quickly it can become a mess. Unnecessary tags littered everywhere, structure broken, weird nesting, outdated elements, and what was simple to begin with quickly becomes difficult to read or work with.

This is exactly the situation this tool is designed to handle.

HTML Cleaner & Formatter will take your messy or broken HTML, and give you back something clean, readable and workable again. No guessing, no manual fixes - just paste your code, choose a mode, and receive nicely formatted HTML back.

What it actually this tool does?

Basically, the tool attempts to correct structure issues with your HTML, and then depending on the mode it simplifies or preserves the content of the HTML.

This means it will do things like:

  • Correctly close any unclosed tags
  • Fix invalid HTML nesting
  • Remove unnecessary and redundant markup
  • Update deprecated HTML tags to modern equivalents
  • Format the entire document with correct spacing and indentation

What you end up with is something that's easy to read, and easier to work with.

This tool is useful if you are dealing with HTML that is:

  • Generated by visual editors or CMS systems
  • Exported from page builders or templates
  • The result of scraping or content generation
  • Old legacy code

What different modes do?

Different modes and wich to choose is subjective, and there is no one-size-fits-all solution. You will want to remove as much markup as possible sometimes, but then there are times where you need to retain your structure, styling or entire layout. Because of this, you can select from a range of modes.

The same about all modes is:

  • They all fix malformed HTML code (unclosed tags, invalid nesting, etc.)
  • They all replace <b> to <strong>, <strike> to <del>, <tt> to <code>, <acronym> to <abbr>, <dir> to <ul>, <listing> to <pre>, <xmp> to <pre><plaintext> to <pre>
  • They all reformats the html line breaks and indents

But they preserve different html tags and attributes...

Minimal Mode:

  • Preserves <html lang>, <head>, <meta charset name content>, <title>, <body>, <p>, <a href>, <strong>, <em>, <b>, <i>, <s>, <br>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <table>, <thead>, <tbody>, <tr>, <th colspan rowspan>, <td colspan rowspan>, <code>, <pre>, <ul>, <ol>, <li>, <del>, <abbr title>

Standard Mode:

  • Preserves <html lang>, <head>, <meta charset name content>, <title>, <body>, <p>, <blockquote cite>, <hr>, <figure>, <figcaption>, <a href title target>, <strong>, <em>, <i>, <s>, <u>, <br>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <img src alt width height loading>, <picture>, <source srcset sizes media type src>, <video src width height poster controls preload>, <audio src controls preload>, <table>, <caption>, <thead>, <tbody>, <tfoot>, <tr>, <th colspan rowspan>, <td colspan rowspan>, <col span>, <colgroup span>, <code>, <pre>, <ul>, <ol start type reversed>, <li>, <dl>, <dt>, <dd>, <abbr title>, <cite>, <dfn>, <kbd>, <samp>, <var>, <mark>, <small>, <q>, <wbr>, <del datetime cite>, <ins datetime cite>, <sub>, <sup>, <time datetime>

Extended Mode:

  • Preserves <html lang>, <head>, <meta charset name content>, <title>, <body>, <p>, <blockquote cite>, <hr>, <figure>, <figcaption>, <a href title target>, <strong>, <em>, <i>, <s>, <u>, <br>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <img src alt width height loading>, <picture>, <source srcset sizes media type src>, <video src width height poster controls preload>, <audio src controls preload>, <track src kind srclang label default>, <table>, <caption>, <thead>, <tbody>, <tfoot>, <tr>, <th colspan rowspan>, <td colspan rowspan>, <col span>, <colgroup span>, <code>, <pre>, <ul>, <ol start type reversed>, <li>, <dl>, <dt>, <dd>, <abbr title>, <cite>, <dfn>, <kbd>, <samp>, <var>, <mark>, <small>, <q>, <wbr>, <del datetime cite>, <ins datetime cite>, <sub>, <sup>, <time datetime>, <article>, <section>, <main>, <header>, <footer>, <nav>, <aside>, <hgroup>, <address>, <search>, <div>, <span>, <details open>, <summary>, <map name>, <area href alt shape coords target>, <bdi>, <bdo>, <ruby>, <rp>, <rt>

Preserved Styling Mode:

  • Preserves <* class style><html lang>, <head>, <meta charset name content>, <link href rel type>, <title>, <body>, <style>, <p>, <blockquote cite>, <hr>, <figure>, <figcaption>, <a href title target>, <strong>, <em>, <i>, <s>, <u>, <br>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <img src alt width height loading>, <picture>, <source srcset sizes media type src>, <video src width height poster controls preload>, <audio src controls preload>, <track src kind srclang label default>, <table>, <caption>, <thead>, <tbody>, <tfoot>, <tr>, <th colspan rowspan>, <td colspan rowspan>, <col span>, <colgroup span>, <code>, <pre>, <ul>, <ol start type reversed>, <li>, <dl>, <dt>, <dd>, <abbr title>, <cite>, <dfn>, <kbd>, <samp>, <var>, <mark>, <small>, <q>, <wbr>, <del datetime cite>, <ins datetime cite>, <sub>, <sup>, <time datetime>, <article>, <section>, <main>, <header>, <footer>, <nav>, <aside>, <hgroup>, <address>, <search>, <div>, <span>, <details open>, <summary>, <map name>, <area href alt shape coords target>, <bdi>, <bdo>, <ruby>, <rp>, <rt>

Repair Only Mode:

  • Preserves all tags and attributes