Help and FAQ
for the Markup Validator
Nothing
wrong with the validator here, it just knows HTML
better than you do.
-- David Dorward, Validator's
mailing-list.
Table of contents
- About the Markup Validator
- Using this service
- Miscellaneous (Very) Frequently Asked Questions
About the Markup Validator
Help me! I clicked on an
icon and ended up on this strange site!
Don't panic!
The author of the Web page you come from once
used our service to validate that page,
and the page passed validation. The author was
then authorized to use the icon on that page,
as a claim of validity. The icon is used
as a link back to the validation service, so that
the author can revalidate whenever necessary.
This is why, by clicking on the icon, you followed
a link to the current validation results
for the page you came from.
The validation result was certainly positive
("this page is valid..."), but if it wasn't, you
would probably do the author of the page where
the icon was a favor if you could warn him/her
of this abnormal situation.
If you are curious about Markup validation you
may read this help document further, or you may
simply use the back button of your Web browser
to come back to the page where you found the "valid"
icon.
What is Markup Validation?
Most pages on the World Wide Web are written
in computer languages (such as HTML)
that allow Web authors to structure text, add
multimedia content, and specify what appearance,
or style, the result should have.
As for every language, these have their own grammar,
vocabulary and syntax, and every
document written with these computer languages
are supposed to follow these rules. However, just
as texts in a natural language can include spelling
or grammar errors, documents using Markup languages
may (for various reasons) not be following these
rules.
The process of verifying whether a document actually
follows the rules for the language(s) it uses
is called validation, and the tool used
for that is a validator. A document that passes
this process with success is called valid.
Is validation some kind
of quality control? Does "valid" mean "quality
approved by W3C"?
Validity is one of the quality criteria for a
Web page, but there are many others. In other
words, a valid Web page is not necessarily
a good web page, but an invalid Web page
has little chance of being a good web page.
For that reason, the fact that the W3C Markup
Validator says that one page passes validation
does not mean that W3C assesses
that it is a good page. It only means that a tool
(not necessarily without flaws) has found the
page to comply with a specific set of rules. No
more, no less. This is also why the "valid ..."
icons should never be considered as a "W3C seal
of quality".
What is the Markup Validator
and what does it do?
The Markup Validator is a free tool and service
that checks the syntax of (X)HTML documents.
The Validator is sort of like lint
for C. It compares your HTML document to the defined
syntax of HTML and reports any discrepancies.
Learn more about
the Markup Validator.
Why should I validate my HTML
pages?
One of the important maxims of computer programming
is: Be conservative in what you produce; be
liberal in what you accept.
Browsers follow the second half of this maxim
by accepting Web pages and trying to display them
even if they're not legal HTML. Usually this means
that the browser will try to make educated guesses
about what you probably meant. The problem is
that different browsers (or even different versions
of the same browser) will make different guesses
about the same illegal construct; worse, if your
HTML is really pathological, the browser
could get hopelessly confused and produce a mangled
mess, or even crash.
That's why you want to follow the first half
of the maxim by making sure your pages are legal
HTML. The best way to do that is by running your
documents through one or more HTML validators.
A lengthier answer to
this question is also available on this site if
the explanation above did not satisfy you.
Who owns/maintain the
Markup Validator?
The Markup Validator is maintained at W3C by W3C staff and benevolent
collaborators, who receive a lot of help from
contributors (read the full
credits).
What other validators are there?
We're doing our best to provide clear and reliable
results as well as a good interface with the Markup
Validator, but for some reason you may want to
check other validators. Here are a few choices:
Looking for validators at W3C, but not the Markup
Validator? Check out the list of validators
at W3C, including well-known CSS
validator, link
checker, etc.
How does The Validator work?
The Validator is based on James
Clark's nsgmls
SGML parser. The Validator itself is a CGI script
that fetches your URL, passes it through nsgmls,
and post-processes the resulting error list for
easier reading.
How do I send feedback/bug
reports about the Markup Validator?
Read the instructions on our Feedback
page.
Using this service
How do I use this service?
Most probably, you will want to use the online
Markup Validation service. The simple way to use
this service to validate a Web page is to paste
its address into the text area
on the validator's home page,
and press the "Check" button.
There are other possible uses and a few usage
options, please read the user's
manual for further help with this service.
If, for some reason, you prefer running your
own instance of the Markup Validator, check out
our developer's documentation.
What are these error messages?
The output of the Markup Validator may be hard
to decipher for newcomers and experts alike, so
we are maintaining a list of error messages and their interpretation, which
should help.
Many error messages? Don't
panic.
Don't panic. Did The Validator complain about
your DOCTYPE declaration (or lack
thereof)? Make sure your document has a syntactically
correct DOCTYPE declaration, as described
in the section on
DOCTYPE, and make sure it correctly
identifies the type of HTML you're using. Then
run it through The Validator again; if you're
lucky, you should get a lot fewer errors.
If this doesn't help, then you may be experiencing
a cascade failure — one error that gets
The Validator so confused that it can't make sense
of the rest of your page. Try correcting the first
few errors and running your page through The Validator
again.
Be patient, with a little time and experience
you will learn to use the Markup Validator to
clean up your HTML documents in no time.
I don't want error messages, I
want you to clean up my page!
The Markup Validator can not do this for you.
You may want to have a look at tools such as HTML
Tidy.
My document is valid, can I use your
"valid" icon?
Practical use of the icon
Yes. To show readers that one has taken some care
to create an interoperable Web page, a "W3C valid"
badge may be displayed (here, the "valid XHTML
1.0" badge) on any page that validates.
We encourage you to use the XHTML code below
(or its HTML equivalent), but you may use a different
code to integrate the icon within your web page
as long as the icon is used as a link to revalidate
the Web page it is in. Sample code is as follows:
<p>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
</p>
License and Guidelines for usage of the "valid"
icons
Web content providers are granted the right to
use the "W3C valid" logo on pages that pass validation
(though the use of the W3C
Markup Validator) for the W3C technology represented
by the icon, and only on pages
that pass validation. The icon must be used as
a link to revalidate the Web page, thus providing
a way to verify the page author's assertion that
it passed validation.
Note that "W3C Valid" icons are not an endorsement
by the W3C of the page's author, the substantive
content of the page, nor its design. Instead,
the icons are only a mechanism
to identify pages that have been determined to
be valid, and to easily re-validate pages as often
as as they are modified.
Consequently, the use of the badge is in accordance
with and governed by the W3C Trademark
License and Logo
and Icon usage policy.
Miscellaneous (Very) Frequently
Asked Questions
No DOCTYPE Declaration Found!
A DOCTYPE Declaration is mandatory for most
current markup languages and without one it is
impossible to reliably validate a document.
One should place a DOCTYPE declaration as the
very first thing in an HTML document. For example,
for a typical XHTML 1.0 document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Title</title>
</head>
<body>
<!-- ... body of document ... -->
</body>
</html>
For XML documents, you may also wish to include
an "XML Declaration" even before the DOCTYPE Declaration,
but this is not well supported in older browsers.
More information about this can be found in the
XHTML 1.0
Recommendation.
The W3C QA Activity maintains a List of Valid
Doctypes that you can choose from, and the
WDG maintains a document on "Choosing
a DOCTYPE".
No Character Encoding Found!
An HTML document should be served along with
its character encoding.
Specifying a character encoding is normally
done in the web server configuration file or administration
program. The W3C I18N Activity has collected
a few tips
on how to do this in popular web server implementations.
IANA maintains the
list of official names for
character sets and the WDG has some information
to help you correctly specify the character encoding.
To quickly check whether the document would
validate after addressing the missing character
encoding information, you can use the "Encoding"
form control (accesskey "2") earlier in the page
to force an encoding override to take effect.
"iso-8859-1" (Western Europe and North America)
and "utf-8" (Universal, but not commonly used
in legacy documents) are common encodings if you
are not sure what encoding to choose.
The validator complains about
"&" in my URLs!
Most probably, you should read the ampersand section
of WDG's excellent "common
validation problem"
The validator complains
about something in my JavaScript!
Most probably, you should read the script
section of WDG's excellent "common
validation problem"
HTML is based on SGML
and uses an SGML feature (called SHORTTAG) (note
that this is not the case with
XHTML).
With this feature enabled, the "/" in <link
... /> or <meta ... /> already closes
the link (or meta) tag, and the ">" becomes
some regular text, which is not allowed in the
<head> element. Since </head><body>
is optional in HTML (again, not
in XHTML), it is silently inserted, thus head-only
elements like meta and style as well as "</head>"
and "<body>", which may appear only once,
become false.
(explanation courtesy of Christoph Päper)
I found some nasty typo like <p<a
...> and the validator accepted it!
This again (as in the previous
case) comes from the SHORTTAG feature in HTML
(not in XHTML). The typo is actually
a "shorthand markup" and is a valid construct
in HTML, even though its use is
not recommended.
/check/referer does not work
- or - the validator says it does not support
my "undefined" URL scheme
Browsers and other Web agents usually send information
about the page they come from, in a Referer
header. The validator uses this information for
a features that allows it to validate whatever
page the browser last visited. The "valid" icons
on some Web page usually point to the validation
of the page using this feature.
Unfortunately, some zealous "security software"
or Web proxies strip the referrer information
from what the browser sends. Without this information
the validator is not able to find what the URL
of the document to validate is, and gives the
same error message as when it is given a type
of URL it does not understand.
How to fix:
- Check that it is indeed the
Referer
issue. The validator should have redirected
you to http://validator.w3.org/check?uri=.
Otherwise, check the address you have given
the validator.
- The validator can not fix this issue. You
will have to (ask your administrator to) reconfigure
whichever zealous software is stripping this
referrer info.
- If you have a link on your page using the
"/check/referer" feature, you could replace
them with the a link to the validator without
this feature, e.g.
http://validator.w3.org/check?uri=http://www.example.com
- If you have no control over the page or annoying
software, simply append the address of the page
you wanted validated to the
http://validator.w3.org/check?uri=
address.