CINXE.COM

User Documentation for The W3C Markup Validator

<!doctype html> <html lang="en"> <head> <base href="https://validator.w3.org/docs/users.html"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>User Documentation for The W3C Markup Validator</title> <link rel="help" href="mailto:www-validator@w3.org"> <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> <link rel="start" href="../" title="Home Page"> <link rel="stylesheet" href="../style/base" type="text/css" media="all"> <meta name="keywords" content="HTML, HyperText Markup Language, Validation, W3C Markup Validation Service"> <meta name="description" content="W3C's easy-to-use markup validation service, based on SGML and XML parsers."> <meta http-equiv="X-Translated-By" content="Google"> <meta http-equiv="X-Translated-To" content="en"> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.tKc6KWkFf-8.O/am=gAE/d=1/rs=AN8SPfrf36LIV3DkhtRBGWFnLWWzaykPyw/m=corsproxy" data-sourceurl="https://validator.w3.org/docs/users.html"></script> <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" rel="stylesheet"> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.tKc6KWkFf-8.O/am=gAE/d=1/exm=corsproxy/ed=1/rs=AN8SPfrf36LIV3DkhtRBGWFnLWWzaykPyw/m=phishing_protection" data-phishing-protection-enabled="false" data-forms-warning-enabled="true" data-source-url="https://validator.w3.org/docs/users.html"></script> <meta name="robots" content="none"> </head> <body> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.tKc6KWkFf-8.O/am=gAE/d=1/exm=corsproxy,phishing_protection/ed=1/rs=AN8SPfrf36LIV3DkhtRBGWFnLWWzaykPyw/m=navigationui" data-environment="prod" data-proxy-url="https://validator-w3-org.translate.goog" data-proxy-full-url="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" data-source-url="https://validator.w3.org/docs/users.html" data-source-language="auto" data-target-language="en" data-display-language="en-GB" data-detected-source-language="en" data-is-source-untranslated="false" data-source-untranslated-url="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://validator.w3.org/docs/users.html&amp;anno=2" data-client="tr"></script> <div id="banner"> <h1 id="title"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/"> <img alt="W3C Logo" width="110" height="61" id="logo" src="../images/w3c.png"> </a> <a href="https://validator-w3-org.translate.goog/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB"><span>Markup Validation Service</span></a></h1> <p id="tagline">Check the markup (HTML, XHTML, …) of Web documents</p> </div> <div class="doc"> <h2>A user guide for the W3C Markup Validator</h2> <p>The W3C Markup Validator provides Perl/CGI/SGML/XML/DTD-based validation of a variety of document types. SGML and DTDs are older technologies that never found wide use on the Web, so for checking of HTML documents using modern technologies, you probably want to instead use the <a href="https://validator-w3-org.translate.goog/nu/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">W3C HTML Checker</a>. To do that,</p><img src="../images/HTML5_Badge_32.png" alt="HTML5" class="html5_logo_32"> <ul> <li>Download the <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/releases/latest">latest release version</a>.</li> <li>Read the <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=http://validator.github.io/validator/">usage guide</a>.</li> </ul> <p>If for some reason rather than using the W3C HTML Checker, you want to use the W3C Markup Validator, this page provides the following information:</p> <div id="toc"> <ul> <li><a href="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#Installing">Running your own instance of the W3C Markup Validator</a></li> <li><a href="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#Calling">Using the W3C Markup Validator API</a></li> <li><a href="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#Options">Controlling the behavior of the W3C Markup Validator</a></li> <li><a href="https://validator-w3-org.translate.goog/docs/api.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#http_headers">Using HTTP headers to check validation results</a></li> </ul> </div> <div id="Installing" class="stb"> <h3>Running your own instance of the W3C Markup Validator</h3> <p>To provide your own service for checking HTML documents, you probably want to run an instance of the <a href="https://validator-w3-org.translate.goog/nu/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">W3C HTML Checker</a>. Instructions on how to do that are available in the following guide:</p> <ul> <li><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=http://validator.github.io/validator/">The Nu Html Checker: Usage, Options, and Web-based checking</a></li> </ul> <p>To instead run an instance of the W3C Markup Validator, you can find out more by reading about its <a href="https://validator-w3-org.translate.goog/source?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">source code and package availability</a>, along with its <a href="https://validator-w3-org.translate.goog/docs/install.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">installation manual</a> and <a href="https://validator-w3-org.translate.goog/docs/devel.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">an additional guide that provides more information for developers</a>.</p> </div> <div id="Calling" class="stb"> <h3>Using the W3C Markup Validator API</h3> <p>For programmatic checking of modern HTML documents, use the API provided by the <a href="https://validator-w3-org.translate.goog/nu/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">W3C HTML Checker</a>. To do that, call <a href="https://validator-w3-org.translate.goog/nu/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB">https://validator.w3.org/nu/</a> or the URL for another instance of the W3C HTML Checker, and consult the following documentation:</p><img src="/images/HTML5_Badge_128.png" alt="HTML5" class="html5_logo_128"> <ul style="list-style-type: none"> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Service-%C2%BB-Input-%C2%BB-GET">W3C HTML Checker GET interface</a></li> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Service-%C2%BB-Input-%C2%BB-POST-body">W3C HTML Checker POST interface</a></li> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params">W3C HTML Checker parameters</a></li> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Output-%C2%BB-JSON">W3C HTML Checker out=json format</a></li> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Output-%C2%BB-XML">W3C HTML Checker out=xml format</a></li> <li style="list-style-type: none"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://github.com/validator/validator/wiki/Output-%C2%BB-GNU">W3C HTML Checker out=gnu format</a></li> </ul> </div> <div id="Options" class="stb"> <h3>Controlling the behavior of the W3C Markup Validator</h3> <p>This section describes the behavior of each of the options exposed in the W3C Markup Validator user interface, and names of the corresponding query parameters (shown in parentheses) you can use with the W3C Markup Validator API.</p> <dl> <dt> <a id="option-charset" name="option-charset"></a>Encoding (<code>charset</code>) </dt> <dd> <p>This allows you to <strong>override</strong> the character encoding information about your document. You may use this option for test purposes, but you will eventually have to serve your document with the correct character encoding, or the validator will <a href="https://validator-w3-org.translate.goog/docs/help?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#faq-charset">complain</a> about it and you document will not be valid.</p> </dd> <dt> <a id="option-fbc" name="option-fbc"></a>Use Fallback instead of Override (<code>fbc</code>) </dt> <dd> <p>Uses the <a href="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#option-charset">character encoding override</a> mechanism described above, but only does it as a fall back mechanism if the actual document is not served with character encoding information. Think of this as a gentler override mechanism.</p> </dd> <dt> <a id="option-doctype" name="option-doctype"></a>Document Type (<code>doctype</code>) </dt> <dd> <p>This allows you to <strong>override</strong> the DOCTYPE declaration for your document. You may use this option for test purposes, but you will eventually have to serve your document with the correct DOCTYPE declaration, or the validator will <a href="https://validator-w3-org.translate.goog/docs/help?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#faq-doctype">complain</a> about it and you document will not be valid.</p> </dd> <dt> <a id="option-fbd" name="option-fbd"></a>Use Fallback instead of Override (<code>fbd</code>) </dt> <dd> <p>Uses the <a href="https://validator-w3-org.translate.goog/docs/users.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB#option-doctype">Doctype override</a> mechanism described above, but only does it as a fall back mechanism if the actual document does not have a Doctype declaration. Think of this as a gentler override mechanism.</p> </dd> <dt> <a id="option-ss" name="option-ss"></a>Show Source (<code>ss</code>) </dt> <dd> <p>Displays the HTML source of the document you validated and links error messages directly to lines in this output. Makes it easy to see what's wrong.</p> </dd> <dt> <a id="option-outline" name="option-outline"></a>Show Outline (<code>outline</code>) </dt> <dd> <p>Will generate an outline of your document from the H1 - H6 elements. For a properly formed document, this will be a nicely nested tree structure. The visualization of your document's structure makes it easier to see where you've skipped a heading.</p> <p>If you want to examine the semantic structure of your documents, beyond the outline, try the <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=http://www.w3.org/2003/12/semantic-extractor.html">Semantic data extractor</a>.</p> </dd> <dt> <a id="option-no200" name="option-no200"></a>Validate error pages (<code>No200</code>) </dt> <dd> <p>The W3C Markup Validator will usually tell you if the page you tried to validate could not be retrieved (for example, if the server gave a "404 not found" message. In some circumstances you may want to be able to validate the error page sent by the server. This is the option to use then.</p> </dd> <dt> <a id="option-verbose" name="option-verbose"></a>Verbose Output (<code>verbose</code>) </dt> <dd> <p>This option triggers verbose output. Verbose output adds more explanations and suggestions to the validation results, and gives more information on the resource validated. This makes it a useful option if you prefer to be given as much help as possible; if you prefer more concise reports, leave this option unset.</p> </dd> <dt id="option-accept"> For Content-Negotiated resources, set a specific <code>Accept</code> Header (<code>accept</code>) </dt> <dd> <p>This option (<em>experimental, as of 0.8.2</em>) is useful if your Web server is set up to use format negotiation, serving different content based on the preferred/accepted media types of the user agent. The validator can then emulate different HTTP <code>Accept</code> behaviors.</p> <p>For example, append "<code>accept=application%2Fxhtml%2Bxml%2C*</code>" and the validator will send the HTTP Header "<code>Accept: application/xhtml+xml,*</code>".</p> </dd> <dt id="option-accept-language"> For Content-Negotiated resources, set a specific <code>Accept-Language</code> Header (<code>accept-language</code>) </dt> <dd> <p>This option (<em>experimental, as of 0.8.2</em>) is useful if your Web server is set up to use language negotiation, serving content in different languages based on the preferred/accepted language setup of the user agent. The validator can then emulate different HTTP <code>Accept-Language</code> behaviors.</p> <p>For example, append "<code>accept-language=ja%2Cfr</code>" and the validator will send the HTTP Header "<code>Accept-Language: ja,fr</code>".</p> </dd> <dt id="option-accept-charset"> Set a specific <code>Accept-Charset</code> Header (<code>accept-charset</code>) </dt> <dd> <p>This option (<em>experimental, as of 0.8.3</em>) makes the validator send an <code>Accept-Charset</code> HTTP header, specifying the character encodings which it will accept from server. This option is mainly used to interface the W3C Markup Validator for <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=http://www.w3.org/TR/mobileOK-basic10-tests/%23http_request">Mobile Web Best Practices</a> checking.</p> </dd> <dt id="option-user-agent"> Set a specific <code>User-Agent</code> Header (<code>user-agent</code>) </dt> <dd> <p>This option (<em>experimental, as of 0.8.3</em>) makes the validator send a custom <code>User-Agent</code> HTTP header instead of the usual <code>W3C_Validator/xx.xxxx</code>. If the value of this parameter is <code>mobileok</code>, the validator will output a <code>User-Agent</code> string as defined by the <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=http://www.w3.org/TR/mobileOK-basic10-tests/%23http_request">Mobile Web Best Practices</a> spec.</p> </dd> </dl> </div> </div> <ul class="navbar" id="menu"> <li><a href="https://validator-w3-org.translate.goog/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" accesskey="1" title="Go to the Home Page for The W3C Markup Validation Service">Home</a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/about.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" title="Information About this Service">About...</a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/whatsnew.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" title="The changes made to this service recently">News</a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/docs/?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" accesskey="3" title="Documentation for this Service">Docs</a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/docs/help.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" title="Help and answers to frequently asked questions">Help&nbsp;&amp;&nbsp;<abbr title="Frequently Asked Questions">FAQ</abbr></a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/feedback.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" accesskey="4" title="How to provide feedback on this service">Feedback</a><span> | </span></li> <li><a href="https://validator-w3-org.translate.goog/contribute.html?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-GB" title="How to contribute to the validator project">Contribute</a><span> | </span></li> </ul> <div id="footer"> <p id="activity_logos"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/Status" title="W3C's Open Source, bringing you free Web quality tools and more"><img src="https://www.w3.org/assets/logos/w3c/w3c-no-bars.svg" alt="W3C" width="72" height="47"><img src="./images/opensource-55x48.png" alt="Open-Source" title="We are building certified Open Source/Free Software. - see www.opensource.org" width="55" height="48"></a></p> <p id="support_logo"><a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/donate/"> <img src="https://www.w3.org/QA/Tools/I_heart_validator" alt="I heart Validator logo" title="Donate to W3C" width="80" height="15"> </a></p> <p class="copyright"><span lang="en" dir="ltr">Copyright © 2024 <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/policies/%23disclaimers">liability</a>, <a href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/policies/%23trademarks">trademark</a> and <a rel="license" href="https://translate.google.com/website?sl=auto&amp;tl=en&amp;hl=en-GB&amp;u=https://www.w3.org/copyright/document-license/" title="W3C Document License">permissive license</a> rules apply.</span></p> </div><!-- footer --> <script src="https://www.w3.org/QA/Tools/w3c-include.js"></script> <script>function gtElInit() {var lib = new google.translate.TranslateService();lib.translatePage('en', 'en', function () {});}</script> <script src="https://translate.google.com/translate_a/element.js?cb=gtElInit&amp;hl=en-GB&amp;client=wt" type="text/javascript"></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10