• United States

Been there, Tidy’ed that

Feb 12, 20033 mins
Enterprise Applications

* Making HTML code clean and dandy

Unless you are some kind of infallible robot, you will make mistakes when writing HTML. And even when you use other companies’ tools you can still find mistakes creeping in because of their commercial bias (did someone mention Microsoft?).

Anyway, here’s a tool that will proof your HTML to make sure that it is clean and tidy: The tool is called (not surprisingly) HTML Tidy or just Tidy for short and it is available from SourceForge ( ).

According to the Tidy’s original author Dave Raggett, Tidy can clean up “atrociously hard to read markup generated by specialized HTML editors and conversion tools” (FrontPage?) and can help identify where you can improve readability for people with disabilities.

Tidy can identify and fix a wide range of problems and list each problem found with line number and column listed so that errors in markup can be identified. If there are problems that Tidy isn’t sure of how to handle it won’t generate a cleaned up version.

The tool detects and corrects:

* Missing or mismatched end tags.

* End tags in the wrong order.

* Problems with heading emphasis.

* Mixed up tags.

Tidy also:

* Puts

tags in the right place.

* adds missing “/” in end tags for anchors.

* Perfects lists by putting in omitted tags.

* Adds missing quotes around attribute values.

* Reports unknown and proprietary attributes.

* Recognizes proprietary elements and reports them.

* Works out which version of HTML you are using and insert the appropriate DOCTYPE element, as per the W3C recommendations.

* Identifies tags lacking a terminating ‘>’; and generates cleaned up markup.

* Supports multiple character encodings.

* Copes with ASP, JSTE and PHP pseudo elements within element content and as replacements for attributes.

* Has limited support for XML.

You can also teach Tidy about new tags. And it is free and open source – phew!

A library of Tidy functions has been developed to support the use of Tidy within other software.

Binary versions are available for FreeBSD/x86, Linux/Alpha, Linux/PPC, Linux/Sparc, Linux/x86, Mac OS X/Darwin, Solaris/Sparc, Windows 95/98/ME/2000/XP, MkLinux, Mac OS (Classic), Mac OS X, and OS/2.

Want more? There’s also Tidy for Atari, MiNT (Atari), Amiga, BeOS, AIX v4.3.2 and later, UnixWare, HP-UX, RISC OS, and OpenVMS.

There are even Web interfaces for Tidy as well as Java, C++ and Perl versions and various GUI clients (see the SourceForge project page). You want some version of it, someone has probably already done it.


Mark Gibbs is an author, journalist, and man of mystery. His writing for Network World is widely considered to be vastly underpaid. For more than 30 years, Gibbs has consulted, lectured, and authored numerous articles and books about networking, information technology, and the social and political issues surrounding them. His complete bio can be found at

More from this author