Sitemap Glossary

What is <loc>?

The XML tag inside a sitemap that specifies the URL of a page.

Written by SitemapKit Editorial TeamUpdated: Jul 21, 2026

Key takeaways

  • Interpret <loc> in its sitemap XML context; the detailed definition below explains its role and constraints.
  • Validate <loc> against a real XML example instead of relying on the field or tag name alone.

The `<loc>` element is the only required child of a `<url>` entry in an XML sitemap. It contains the full, absolute URL of a page on the website. The URL must include the protocol (http or https) and must be properly encoded.

Special characters like ampersands (`&`), quotes, and angle brackets must be XML-escaped. For example, `&` becomes `&amp;`. URLs should be under 2,048 characters.

SitemapKit's extract endpoint parses the `<loc>` tag from every URL entry and returns it in the structured JSON response.

XML example

<url>
  <loc>https://example.com/products/widget-a?ref=home&amp;color=blue</loc>
</url>

Continue with SitemapKit

Sources and further reading

Work with sitemaps programmatically

SitemapKit's API discovers and parses XML sitemaps into structured JSON, including fields such as loc.

Related terms