HTML tables are among the most structurally complex elements in the language, and they suffer the most from poor formatting.
Loading HTML Formatter…
Correctly indents all table elements at their nesting depth
Handles thead, tbody, tfoot, colspan, and rowspan markup
Makes row and column structure immediately visible
Free with no installation required
Drop the HTML Formatter into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/html/html-formatter?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="HTML Formatter by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
HTML tables have a multi-level element hierarchy that is unique in the language. A table contains thead, tbody, and tfoot section elements; each section contains tr row elements; each row contains th and td cell elements; and each cell can contain arbitrary nested HTML. A medium-sized data table can produce four or five nesting levels before you even start counting the content inside the cells. Without correct indentation at every level the boundaries between rows blur into the boundaries between cells, and the only way to verify that a row has the expected number of cells is to count tags one at a time, which is the kind of work no human should do when a parser can do it for them.
FixTools indents table elements according to the canonical HTML5 table model. The table opens at whatever nesting depth its surroundings dictate. The thead, tbody, and tfoot sections each get one level deeper. The tr elements inside those sections get two levels deeper than the table. The th and td cells inside the rows get three levels deeper. Nested tables, which appear in legacy email templates and some CMS exports, get treated as full subtree elements within their containing cell and carry the indentation forward from there. The result is markup where the visual depth of any line tells you exactly what role the element plays in the table structure.
A common source of table rendering bugs is structural inconsistency that is invisible in unformatted markup. A row that has one extra cell will misalign every column to its right; a colspan value that doesn't add up to the total column count will produce phantom or missing cells; a th that should be a td will confuse screen readers about which elements are headers and which are data. All three of these problems jump out of formatted table markup because the indentation makes the cell count per row immediately countable. They are nearly impossible to spot in unformatted markup, which is why many table debugging workflows now start with a formatting pass before any other investigation.
For accessibility specifically, the value of formatted table markup is even higher. WCAG 2.1 requires data tables to have proper header associations, achieved either through scope attributes on th elements or through headers attributes on td elements pointing to th ids. Auditing whether these associations are correct on a non-trivial table is genuinely difficult on compressed markup and genuinely straightforward on formatted markup, because the formatted version puts every th and td in clear context where the attributes are easy to scan. Accessibility audits on table-heavy pages routinely take a fraction of the time on formatted source compared to unformatted source.
Paste any HTML containing tables and click Format. Every table element is indented to the correct depth, making the row and column structure clear at a glance.
Step-by-step guide to format html table code online:
Paste your table HTML
Paste any HTML containing one or more tables into the input panel. The formatter handles single tables, multiple tables on the same page, and nested tables within table cells.
Click Format
Click Format. Table elements are indented at the correct depth for their level in the table hierarchy, with thead, tbody, tfoot, tr, th, and td each at their expected position.
Verify row and column structure
Scan the formatted output to verify that each tr contains the correct number of td or th cells and that thead, tbody, and tfoot sections are correctly placed. The indentation makes any anomaly stand out.
Copy the formatted HTML
Copy the formatted output and use it in your editor, paste it into documentation, or use it as the basis for further debugging or accessibility review.
Common situations where this approach makes a real difference:
Debugging a pricing comparison table
A six-column, fifteen-row pricing table has a rendering misalignment that appears only in Firefox. The developer formats the 18KB table HTML and within seconds spots a missing td in row nine of the comparison data, which causes every cell to its right to shift one column over. The bug had survived three rounds of code review because no reviewer was willing to count cells in compressed markup. The formatted output made the missing cell unmissable.
Formatting a data table exported from Excel
An Excel-to-HTML export produces a single-line 42KB table for a financial report. Formatting reveals that the export omitted the thead section entirely and replaced every th with a td, breaking screen reader navigation of the column headers. The team fixes the export pipeline to emit proper header markup before the report ships, catching the accessibility issue weeks before it would have hit production.
Preparing a financial report table for accessibility review
A 200-row financial summary table goes into accessibility review before publication. The team formats the table first, and the reviewer notices in the first ten minutes that scope attributes are missing on every column header. Adding the scope attributes takes a quarter of an hour. Without formatting, the same issue might have been missed during the audit or might have taken hours to identify across the unformatted source.
Reviewing an email template with layout tables
A legacy HTML email template for a monthly newsletter uses nested tables for layout because the recipients include older email clients that don't support CSS grid. Formatting the 55KB template reveals four levels of table nesting and three inner tables with incorrect column counts that were producing rendering glitches in Outlook. All three issues are fixed in a single session before the campaign sends.
Use this when you need to read, edit, or debug HTML tables that are compressed or inconsistently indented, making it hard to verify row and column structure.
Get better results with these expert suggestions:
Use formatting to debug responsive table issues
Responsive table strategies such as horizontal scrolling at narrow widths, stacking rows as cards on mobile, or hiding lower-priority columns all depend on the underlying table structure being correct before any CSS can do its work. Formatting the table HTML first lets you verify the structural assumptions your responsive CSS depends on. A misplaced th or an inconsistent colspan that breaks responsive behavior is much easier to find in the formatted source than in the unformatted source, and a quick formatting pass should be the first step in any responsive table debugging session.
Format before auditing table accessibility
WCAG 2.1 success criteria for data tables include requirements for headers, captions, and the association between headers and cells. Auditing whether a table meets these requirements is far easier on formatted markup. Each th sits in clear context with its scope attribute visible, each td shows its headers attribute if it has one, and the caption element if present is unmissable at the top of the table. Plan to format every table you audit, and the audit itself will move from a tedious counting exercise to a straightforward review.
Format nested tables with care
Nested tables are strongly discouraged in modern web development and have been since the move away from table-based layouts in the mid-2000s. They still appear in legacy email HTML, where modern layout techniques such as CSS grid are not reliably supported, and in some older CMS exports. When formatting nested tables, the inner table adds three or four more indent levels on top of the outer table's nesting. If the resulting indentation pushes content past the right edge of your editor, treat that as a signal: the nesting may be reducible, and a quick refactor can simplify both the markup and the maintenance burden.
Use formatted table output to generate spreadsheet exports
When extracting tabular data from an HTML table for use in a spreadsheet or analysis tool, format the HTML first so the row and cell boundaries are visible. The formatted structure makes it trivial to write a small script that walks the rows and emits CSV, and it also makes manual extraction far less error-prone if scripting isn't available. Without formatting, the cell-to-cell boundaries in compressed source are easy to miscount, and the resulting export ends up shifted by one column.
Format tables to verify colspan and rowspan
After formatting, count the effective cell count per row by checking how many td/th elements appear at the third indentation level within each tr. Cells with colspan span multiple columns and should match the table's column count when summed.
Use scope attributes for accessible tables
After formatting makes your table structure visible, review th elements for scope="col" and scope="row" attributes. Correctly scoped headers are required for screen reader accessibility in data tables.
Format before converting tables to CSS grid
When migrating a layout table to CSS grid, format the table HTML first to clearly see the structure you are replacing. The formatted output shows exactly which cells span multiple columns or rows.
More use-case guides for the same tool:
Open the full HTML Formatter — free, no account needed, works on any device.
Open HTML Formatter →Free · No account needed · Works on any device