Sitemap XML format
Every element of the Sitemaps 0.9 XML format, with the size limits, encoding and escaping rules, which fields Google uses, and the RSS, Atom and text alternatives.
Type: ReferenceVersionSitemaps 0.9On this page
| Specification | Sitemaps XML format, sitemaps.org |
|---|---|
| Current version | 0.9 (namespace http://www.sitemaps.org/schemas/sitemap/0.9) |
| Encoding | UTF-8 |
| Limits per file | 50,000 URLs and 50 MB (52,428,800 bytes) uncompressed |
| Compression | gzip allowed; the limits apply to the uncompressed file |
| Larger sites | Several sitemaps listed in a sitemap index |
A complete sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-11-30</lastmod>
</url>
<url>
<loc>https://example.com/docs/install</loc>
<lastmod>2026-11-18T14:05:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://example.com/search?topic=xml&sort=new</loc>
</url>
</urlset>The first entry uses a date alone, the second a full timestamp with a time zone, and the third no optional fields at all. The ampersand in the third URL is written as & because the file is XML.
Elements
| Element | Required | Content |
|---|---|---|
| urlset | Yes | The root element. Its xmlns attribute names the protocol version: http://www.sitemaps.org/schemas/sitemap/0.9. |
| url | Yes, one per URL | Parent element for one entry. Contains loc and any optional children. |
| loc | Yes | The absolute URL of the page, beginning with the scheme. It must be less than 2,048 characters and is used exactly as written, so include a trailing slash if the server's URL has one. |
| lastmod | No | When the page itself last changed, in W3C Datetime format. A date in YYYY-MM-DD form is enough. The protocol says it is not the time the sitemap was generated. |
| changefreq | No | How often the page is likely to change: always, hourly, daily, weekly, monthly, yearly or never. A hint, not a command. |
| priority | No | Priority of the URL relative to other URLs on the same site, from 0.0 to 1.0. The default is 0.5. It has no effect on comparisons with other sites. |
Encoding and escaping
The file must be UTF-8, and every URL must be escaped for XML. The protocol lists five characters that need entity escapes inside data values:
| Character | Escape |
|---|---|
| Ampersand (&) | & |
| Single quote (') | ' |
| Double quote (") | " |
| Greater than (>) | > |
| Less than (<) | < |
The protocol also asks that URLs be URL-escaped for the web server and follow RFC 3986 for URIs or RFC 3987 for IRIs. In practice a non-ASCII character in a path is percent-encoded first, and the XML escapes are applied to the result. A generator that builds the file with an XML library applies the second step automatically; unescaped ampersands usually come from string concatenation.
Which URLs a sitemap may list
Under the protocol, a sitemap can list only URLs on the same host and scheme, at or below the directory it is served from. A file at https://example.com/docs/sitemap.xml may list https://example.com/docs/install but not https://example.com/blog/. That is why sitemaps usually sit at the root. Two exceptions widen the scope: a site can point to a sitemap on another host from its own robots.txt, which proves it controls both, and Google says the directory rule does not apply to sitemaps submitted through Search Console. See how crawlers find a sitemap.
How Google reads the fields
Google's sitemap documentation says Google ignores priority and changefreq. It uses lastmod when the value is consistently and verifiably accurate, meaning the date of the last significant change to the page's content, not a footer edit or a regenerated copyright year. When Google announced in June 2023 that it was retiring its sitemap ping endpoint, it gave its reasons for dropping the other two: changefreq overlaps with lastmod, and priority is subjective.
For a sitemap read by Google, then, an accurate lastmod is the only optional field that changes anything, and omitting it is better than filling it with the generation time. Other consumers of the protocol may read the remaining fields.
Other formats Google accepts
- RSS 2.0 and Atom 1.0 feeds. A feed of recent posts can be submitted as a sitemap. A feed usually carries only the latest URLs, so it complements a full sitemap rather than replacing it.
- mRSS, for details of video content.
- Plain text. Also defined by the protocol: one URL per line, UTF-8, no header or footer. Google asks for absolute URLs and a file name ending in .txt. A text sitemap cannot carry lastmod.
- Google also defines extensions to the XML format for images, video and news, and the xhtml:link element for language alternates.
All formats share the 50,000 URL and 50 MB limits. An HTML page listing links is not a sitemap in this sense and cannot be submitted in Search Console.
Version history
Google introduced the format as Sitemaps 0.84 in June 2005. In November 2006 Google, Yahoo and Microsoft announced joint support for the protocol, renamed version 0.90 with no other change to the schema. Ask.com and IBM announced support in April 2007. The schema has not changed version since; the namespace URI still ends in 0.9.
See also
- Sitemap index filesA sitemap index is an XML file that lists other sitemaps instead of pages. It is required once a site passes 50,000 URLs or 50 MB in one sitemap, and it is useful well before that for splitting a site by section.
- How crawlers find a sitemapA sitemap only helps once a crawler knows where it is. The Sitemap line in robots.txt, submission in Google Search Console and Bing Webmaster Tools, the retired ping endpoint, and IndexNow for announcing changed URLs.
- Language alternates in sitemapsA sitemap can tell search engines that pages are translations or regional versions of each other, using xhtml:link elements with hreflang values inside each url entry. Every version lists every version, itself included.
- Serving site files: media types, encoding and status codesWhich Content-Type each machine-readable file should be served with, why UTF-8 matters, and how crawlers react to redirects, client errors and server errors when they request robots.txt.
References
- Sitemaps XML format. sitemaps.org sitemaps.org
- Build and submit a sitemap. Google Search Central developers.google.com
- Sitemaps ping endpoint is going away. Google Search Central Blog, 26 June 2023 developers.google.com
- Sitemaps. Wikipedia en.wikipedia.org
- Date and Time Formats (W3C Datetime). W3C Note, 15 September 1997 w3.org
- RFC 3986: Uniform Resource Identifier (URI): Generic Syntax. IETF, January 2005 rfc-editor.org