Check that your code follows the standard
A browser almost always displays something, even when the HTML contains mistakes: it guesses and repairs silently, and not every browser guesses the same way. Validating your code means comparing it with the standard to catch those mistakes before they cause a page to look different from one screen to the next, an accessibility problem, or odd behaviour from your CSS and JavaScript.
Which tool should you use?
This page also gathers the JSON, XML and YAML validators, the SQL formatter, the regex tester, the IBAN checker and the password strength test. For the code of a web page:
- HTML validator: paste the code of a whole page or just a snippet and you get the list of errors and warnings, with the line concerned and an explanation of the rule.
It is useful in several situations:
- before publishing a page, as a final check;
- when a layout breaks for no obvious reason: an unclosed or badly nested tag is often the cause;
- to check a template, an HTML email or a block of code copied from elsewhere;
- to learn: the messages state precisely what the standard expects.
Start with the errors at the top of the list: one forgotten tag often triggers several more further down. Warnings point to discouraged practices that do not stop the page from working.
How it works
The validator is free and needs no account. It does not analyse the code itself: your code is sent to the SuperDevTools server, which passes it to the validation service of the W3C, the body that publishes web standards, and then displays the answer. So do not paste code that contains confidential data.