When I'm developing a website locally sometimes I want to check if the html is valid but I haven't been able to find a good tool. I want it partial as a sanity check when I'm troubleshooting layout issues.

Can you please suggest a tool that can validate HTML offline? I'm not looking for validation inside of an IDE but something that will load the page from the web server.

Thank you!

6 Answers 6


You can download the source and/or packages direct from w3[1].

[1] http://validator.w3.org/source/

  • 1
    +1, and they have a LOT of other really cool tools and libraries available for download.
    – Tim Post
    Aug 1, 2010 at 20:15
  • sudo apt-get install w3c-markup-validator Jul 29, 2016 at 10:46

To save time I use a Firefox Extension called HTML Validator. It adds validation to your view source window, tells you errors and warnings in a bottom pane. Also puts an icon in the bottom of your window showing you a quick reference for yes/no on validation. If no, then you just view source and it shows you exactly what your errors are.

Also validates accessibility.

  • 1
    Oh yeah. Validate as you go. Saves you an extra manual step on each page. Hasn't yet been updated for HTML5, though. Aug 2, 2010 at 6:24

Have you checked out HTML Tidy?

  • This is a very good solution too; and since they provide binaries for almost all platforms it's also a good option for beginners.
    – fwaechter
    Aug 1, 2010 at 21:43

You can validate HTML and CSS locally (and do a lot of other useful things) with the Web Developer Toolbar add-on for Firefox. It's also available for Google Chrome.

  • This is just a quick way of submitting it to the W3C validator. Hardly 'offline'.
    – Kris
    Aug 1, 2010 at 21:13
  • Apologies, I misread the question. You can validate locally, but not offline. Aug 1, 2010 at 21:26

In Debian/Ubuntu you can do:

sudo apt-get install w3c-markup-validator

This will get you the web interface.

If you want to validate from the console, edit /usr/share/doc/w3c-markup-validator/examples/validate.pl and install libwebservice-validator-html-w3c-perl. Now you can run validate.pl with an URL to validate.

  • This works great in browser. Could you describe how to edit validate.pl so it can be run from command line with local file? I don't know python and am not sure how to do it.
    – Rafal
    Oct 13, 2013 at 11:32
  • 1
    @Rafal: you just need to fix the URL so that it points at the webserver that hosts the w3c-markup-validator (which is CGI). It may be that the URL is already fits, if you're running your webserver on port 80. Before installing the console stuff, make sure it works in the browser. That way, you're also sure the URL is correct. Also, it's Perl, not Python. Oct 13, 2013 at 19:51

You can now use the new Linux command line tool htmlval for checking HTML and CSS. With the Linux version, you can use curl to download a URL and pipe it to htmlval.

It will work offline, but of course you need to be online if you're going to fetch a URL from the Internet.

There's also a Windows version of the program.

Note: I'm the developer.

Testing this HTML (in file example.html):

<html lang="en">
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
<span>span has no end tag

With this command (-l for list format, -S for no SEO messages):

htmlval -lS example.html

Produces this error list:

=== File 1 of 1: example.html ===

Error (line 6, col 11): This document has a <title> element but it does not contain a title when it must. Each page on a site should have its own unique (never duplicated) and well-written title.

Error (line 9, col 2): The <badtag> element is not valid. Is it misspelled?

Error (line 10, col 2): The <span> element must have an end tag (</span>) but the end tag was not found, is misplaced, misspelled, or was not seen due to other errors.

Error (line 11, col 2): The end tag for <span> (started in line 10, column 2) should appear before this </body> end tag or this end tag should be deleted or moved. This is a nesting error.

Comment: "Errors and warnings only" mode enabled. Showing only error and warning messages (with some exceptions).

Not the answer you're looking for? Browse other questions tagged or ask your own question.