Validating your code using Unicorn

Post 202 of 262

I am a big fan of the W3C web standards, for several reasons which I will write more about in future posts. All free website templates on are written using valid XHTML and CSS, and I recommend everyone to do their best to keep their code valid. One of the easiest ways to find validation errors is to use a validator service, and one of my favorites is Unicorn, W3C’s unified validator which checks the HTML, the CSS and XML feeds in one single test.

Screenshot of Unicorn, the W3C unified validator service

Test your code

Unicorn can test both published websites by entering the URL of the site, and single HTML/CSS files by using the file upload tab. Each test gives either a green light (if the code is valid) or a red light (if there are errors), and all errors are written out and explained which makes them easy to find in the code. The validator can handle many different standards, including html5. You can test it by entering “” in the URL field to see the result for the frontpage of this site. It will generate a green light for the HTML code since it consists of valid html5, and a red light for the CSS since I currently use two plugins which include CSS that is not valid. The fact that the errors are found in CSS which is not used on the site doesn’t matter, Unicorn finds the errors anyway.

In order to keep your websites optimized and as functional as possible, I recommend making it a habit to test your code every now and then – especially if you use a CMS and switch to a new theme or install a new plugin. In many cases, errors do not affect the rendering of the pages. But in some cases code errors can break entire layouts, and a validation check is an effective way of finding such errors.

Browser tools

There are also useful plugins and addons for most web browsers that give you the possibility to check the code of websites as you view them, for example the Web Developer Toolbar by Chris Pederick. It is available for the Firefox and Chrome browsers, and it is one of the most useful browser addons I know. I use it every day in my work as a template designer, and I recommend it to anyone interested in web design.

Got tips? Share them!

Do you know about any good validation tool that I should include in this entry? Post a comment with a link, and I will check it out.

, , ,

This article was written by Andreas Viklund

Web designer, writer and the creative engine behind this website. Author of most of the free website templates, along with some of the WordPress themes.


mackDecember 31, 2010 at 05:55Reply

Thanks Andreas for the latest post the unicorn validator is new to me i will try it out and see how i get on ,keep up the good work looking forward to more in the new year and all the best
to you

XAQUITOJanuary 1, 2011 at 19:00Reply

Unicorn I did not know, always used separate tools, but there it is all in one.