Code review has a quiet tax, and HTML pays it more than most languages. When indentation is inconsistent, a reviewer cannot skim: every block has to be read character by character to work out what sits inside what. A section that closes one level too early, a wrapper div that swallows a sibling it should not contain, a list item drifting out of its list: these are structural mistakes, and structure is exactly what messy indentation hides. The reviewer burns their attention on spacing noise, and the real questions about the markup never get asked.

The fix is mechanical and takes under a minute. Run one formatting pass with the free HTML Formatter before you submit, with one indent size used consistently, and the markup arrives at review already readable. This guide covers the choice that matters, the pass itself, and what formatting will and will not do for the review.

Contents

  • Quick answer
  • Why indentation is a review issue, not a style preference
  • The one decision: 2 spaces or 4
  • How to format HTML for review, step by step
  • Worked example: the same fragment before and after
  • What to check after the pass
  • Limitations and honest caveats
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Pick one indent size, 2 or 4 spaces, matching the convention your project already uses. Paste the markup into the HTML Formatter, choose that size, press Format HTML, and submit the result, copied or downloaded as a text file. Every file in the change then shares one layout, reviewers read structure instead of spacing, and the markup itself is unchanged: formatting rewrites indentation only, and it all runs in your browser.

Why indentation is a review issue, not a style preference

Indentation in HTML is not decoration. It is the visual encoding of the document tree. A child element sits one step deeper than its parent, siblings align, and a closing tag returns to the level of its opener. When that encoding is consistent, a reviewer can verify the structure of a whole template by looking at its left edge: anything that steps in or out at the wrong place is a candidate bug.

When indentation is mixed, tabs in one file and stray spaces in another, generated blocks pasted in flat, hand edits nudged a level off, the left edge stops meaning anything. The reviewer has to reconstruct the tree mentally for every element, which is slow, tiring and error-prone. Reviews under that load get shallower: people approve what they cannot easily read. A single formatting pass before submission removes the noise floor, so the review conversation can be about whether the structure is right, not about what the structure even is.

There is a second, practical benefit. A change submitted with uniform formatting produces clean comparisons against the previous version. Reviewers see the lines that actually changed instead of a hundred lines that merely moved.

The one decision: 2 spaces or 4

The formatter offers exactly two indent sizes, 2 or 4 spaces, and the right choice is boring on purpose: whichever one the project already uses. Matching the existing codebase matters more than the number itself, because the goal is one layout across every file, not your favourite layout in one file.

If a project genuinely has no convention yet, the practical difference is depth. Deeply nested markup, the kind templates and component output produce, stays narrower and easier to scan at 2 spaces. Shallower, hand-written pages read comfortably at 4. Pick one, write it down for the team if you can, and use it for every file from then on. What never works is mixing: half a change at 2 spaces and half at 4 recreates the noise the pass exists to remove.

How to format HTML for review, step by step

  1. Open the HTML Formatter and paste the HTML you are about to submit into the input box.
  2. Choose an indent size of 2 or 4 spaces, the one your project already uses.
  3. Press Format HTML to beautify the markup.
  4. Copy the result back into your file, or download it as a text file if the review works from files.
  5. Repeat for each file in the change, with the same indent size every time.

That is the whole routine. It happens entirely in your browser, so markup from a private or unreleased project is never uploaded anywhere while you tidy it.

Worked example: the same fragment before and after

Here is the kind of markup that arrives from a generator or a hurried edit, complete and valid, but flat:

<div><p>Hello</p><p>World</p></div>

One pass at a 2-space indent returns:

<div>
  <p>Hello</p>
  <p>World</p>
</div>

The markup is byte-for-byte the same document: one div, two p elements, the same text. What the reviewer gains is the left edge. The two paragraphs visibly sit inside the div and align as siblings, and in a real template, hundreds of lines long, that same instant readability is what lets a reviewer spot the one element that nests where it should not. Scale this fragment up to a full page and the difference is between reading the structure and excavating it.

What to check after the pass

A formatting pass is also a cheap inspection. Before you submit, scan the formatted output once with fresh eyes:

  • Closing tags that step out early. If a block closes at a shallower level than expected, the nesting is not what you thought it was.
  • Siblings that do not align. Elements you believed were at the same level should share an indent. One sitting deeper is inside something, whether you meant it or not.
  • Regions that stayed messy. The formatter assumes the markup is broadly valid, so a stretch that still looks tangled after formatting is a signal the structure there needs a human fix, not another pass.

None of this replaces review. It means the review starts from markup whose structure can actually be seen.

Limitations and honest caveats

Formatting fixes indentation only. It does not repair invalid HTML, close missing tags or validate your markup, so markup that is genuinely broken must be fixed before the pass; formatting broken markup just gives you tidier broken markup.

The pass also has an honest limit as a review tool: it makes structure visible, but it cannot judge it. Whether a section should wrap that content, whether the heading order makes sense, whether a class name matches the project's naming scheme: those stay human questions, which is the point of sending the markup to a reviewer in the first place.

Very large documents are fine to paste, but the work happens on your device, so extremely big files may take a moment. And because nothing is uploaded, nothing is saved either: copy or download the formatted result, since closing the tab discards it.

Common mistakes

  • Formatting with a different indent size per file. One change, one size. Mixed sizes recreate exactly the inconsistency the pass is meant to remove.
  • Choosing your favourite size over the project's. If the codebase uses 2 spaces and you submit 4, every line shows as changed and the review drowns in whitespace diffs.
  • Formatting instead of fixing. If a reviewer flagged mismatched tags, a formatting pass will not close them. Fix the structure, then format.
  • Submitting the minified version for review. Minified markup is for production. Reviewers need the formatted form; minify a separate copy when the page ships.
  • Running the pass and never looking at the result. The scan after formatting is where misplaced nesting gets caught. Submitting blind wastes the cheapest inspection you will ever get.

FAQs

Should I use 2 or 4 spaces for reviewed HTML? Either is fine; consistency is what matters. The HTML Formatter offers both. Pick the one your project already uses, so the formatted markup matches the rest of your codebase, and use it for every file.

Does reformatting markup change how the page renders? Indentation changes do not affect rendering in normal HTML. Formatting only rewrites whitespace layout, so the reviewed file behaves exactly like the one you submitted.

Will formatting fix broken markup a reviewer flagged? No. Formatting fixes indentation only. It does not repair invalid HTML, close missing tags or validate your markup; fix the structure first, then format.

Can I download the formatted result as a file? Yes. After pressing Format HTML you can copy the result or download it as a text file, which is handy when the review happens on the file rather than in a pull request.

Is my HTML uploaded anywhere when I format it? No. Formatting runs entirely in your browser, so markup from a private project never leaves your device.

Conclusion

Good review markup is a courtesy with a payoff: one formatting pass, one indent size, every file consistent, and reviewers spend their judgement on your structure instead of your spacing. Keep the HTML Formatter in that pre-submit routine, and when the question turns from reviewing markup to shipping it, the companion guide on formatted vs minified HTML covers when each form earns its place. The rest of this series lives in the Developer Tools guides archive.