How to Generate an XML Product Feed for Google Shopping

Generate an XML feed for your product catalog
How to build an XML product feed for Google Shopping by hand: example file, required attributes, Merchant Center fetch setup and the errors to avoid.
Table of Contents
Get fresh insights on Google Ads optimization delivered straight to your inbox.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By clicking Sign Up you're confirming that you agree with our Terms and Conditions.

To create a Google Shopping XML feed by hand, write an RSS 2.0 file that declares the namespace xmlns:g="http://base.google.com/ns/1.0", add one <item> per product with the required attributes (id, title, description, link, image_link, availability, price and the identifiers), save it as a UTF-8 .xml file, host it at a public URL and add that URL in Merchant Center as a scheduled fetch. The file can be up to 4 GB, and Google fetches it once a day by default.

This guide gives you a working example file, the attribute rules from Google's product data specification, the Merchant Center steps to submit and schedule the file, and the errors that most often break a hand-built feed. If your store runs on Shopify, the last sections cover when an app is the better route.

What is an XML product feed?

An XML product feed is a file that lists every product you want to advertise, one <item> element per product, with each value inside its own tag. Google Merchant Center reads the file and uses it for Shopping ads, Performance Max and free listings. Google calls it a product data source added from a file.

XML is one of three file types Merchant Center accepts. According to Google's page on creating a product file, you can submit a tab-delimited .txt or .tsv file, or an .xml file in RSS 2.0 or Atom 1.0 format, optionally compressed as .gz, .zip or .bz2. A single file can be up to 4 GB. XML handles nested values such as shipping more cleanly than a flat sheet, which is why most feed tools output it.

What does a Google Shopping XML feed look like?

Here is a minimal, valid feed with one product. It follows the structure in Google's RSS 2.0 specification: an XML declaration, an <rss> root that declares the g namespace, a <channel> with a title, link and description, then the items.

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Example Store</title>
<link>https://www.example.com</link>
<description>Product data for Example Store</description>
<item>
<g:id>FP-34-SS</g:id>
<g:title>Stainless Steel French Press, 34 oz</g:title>
<g:description>Double-wall stainless steel French press with a four-level filter. Holds 34 oz (1 liter).</g:description>
<g:link>https://www.example.com/products/french-press-34oz</g:link>
<g:image_link>https://www.example.com/images/french-press-34oz.jpg</g:image_link>
<g:availability>in_stock</g:availability>
<g:price>49.00 USD</g:price>
<g:brand>Example Brand</g:brand>
<g:gtin>00012345678905</g:gtin>
<g:condition>new</g:condition>
</item>
</channel>
</rss>

Four rules from that specification trip up most hand-built files:

  • Every product attribute needs the g: prefix. Google ignores attributes without it, along with the values they contain. The prefix must match the one declared on the <rss> element.
  • The file is the whole catalog. Include every product in each file, not only the ones that changed. A product left out of the file is removed from Merchant Center.
  • The file name matters. It must end in .xml, and the name registered in Merchant Center must match the file name.
  • Remove empty attributes. Leave a tag out rather than sending it with no value.

Because this is XML, special characters inside values must be escaped: write &amp; for an ampersand, &lt; and &gt; for angle brackets. A single unescaped ampersand in a product title makes the whole file unreadable.

Which attributes are required in the XML file?

The required set comes from Google's product data specification. The table below lists what every product needs, plus the identifiers that depend on the product.

AttributeRequired?Format and limit
idYesUnique per product, up to 50 characters. Keep it stable over time.
titleYesPlain text, up to 150 characters.
descriptionYesPlain text, up to 5,000 characters.
linkYesLanding page URL on your verified domain, starting with http or https.
image_linkYesURL of the main image. At least 500 x 500 pixels for all products from January 31, 2027.
availabilityYesin_stock, out_of_stock, preorder or backorder. The last two also need availability_date.
priceYesNumber plus ISO 4217 currency code, for example 49.00 USD.
brandNew products (except movies, books and musical recordings)Up to 70 characters.
gtinWhen the manufacturer assigned oneDigits only, no dashes or spaces. Only submit a GTIN you know is correct.
mpnOnly when there is no GTINManufacturer part number, up to 70 characters.
conditionUsed or refurbished productsnew, refurbished or used.

Identifiers cause the most confusion. Send gtin whenever the manufacturer assigned one, fall back to mpn plus brand when it did not, and set identifier_exists to no only when the product has neither. Our guide to GTIN, MPN and identifier_exists walks through each case. Apparel sold in some countries also needs color, size, gender and age_group, and the core Merchant Center product attributes post covers the optional ones that help performance.

Check your images now. Google's image_link page says images must be at least 500 x 500 pixels for all products beginning January 31, 2027, and recommends around 1500 x 1500 pixels. Our post on the new Merchant Center image requirements shows how to find small images before enforcement starts.

Image showing what a XML product feed contains

How do you create the XML feed step by step?

Whichever method you use to produce the file, the path to an accepted feed is the same.

1. Collect and clean the product data

Start from your source of truth: the store platform, an ERP or a spreadsheet. Fix values at the source before you build anything: one stable id per variant, the price the shopper actually pays on the landing page, the real stock status, a working image URL and the GTIN where one exists. A value fixed only in the XML file comes back wrong on the next export.

2. Map each field to a Google attribute

Match your column names to Google's attribute names: your SKU to g:id, product name to g:title, variant price to g:price, product URL to g:link. Add google_product_category and product_type so products fall into the right groups, and add attributes such as color or size only when they are accurate.

3. Write and save the file

Generate the XML from your mapped data with a script, a spreadsheet export or a feed tool. Save it in UTF-8: Google lists encodings other than UTF-8 or UTF-16 among the common causes of upload errors. Open the file in a browser or an XML validator to confirm it is well formed before you submit it. If the browser shows a parsing error, Merchant Center will reject the file too.

4. Host it at a public URL

For a scheduled fetch, the URL must start with http://, https://, ftp:// or sftp:// and point directly to the file. Google's scheduled fetch page warns that a link to an HTML page on your site makes processing fail, and that you must not block the Googlebot and AdsBot-Google user agents from the folder that holds the file. You can protect the file with a username and password and enter them in the data source settings.

5. Add the file in Merchant Center

Go to Settings, then Data sources, then Add product source, then Add products from a file. Google's page on adding products from a file lists three options:

  1. Enter a link to your file. Merchant Center fetches it every 24 hours by default. This is the right choice for a feed you update.
  2. Add a file using SFTP. Each upload with the registered file name triggers a sync. The name must match exactly, including capitalization.
  3. Upload a file from your computer. There is no automatic sync, so you re-submit the file every time it changes.

6. Set the fetch schedule and check the first run

Scheduled fetches can run daily, weekly or monthly, at a delivery time you choose. Set the time after your file is regenerated so Google always reads fresh prices and stock. Hourly fetches are not available: if you need more than one update a day, Google suggests the Update button on the data source, a new upload, or the Merchant API. After the first fetch, open the data source to check how many products were processed and review product issues before you launch campaigns.

Which method should you use to generate the feed?

A hand-built file is the most flexible option, but not always the cheapest one to maintain. Pick by how often your catalog changes and who will maintain the file.

MethodHow it worksBest for
Hand-built XML fileYou write or generate the RSS 2.0 file, host it at a URL and let Merchant Center fetch it on a schedule.Small or custom catalogs, platforms without a feed app, full control over every value.
Spreadsheet exportExport products to a sheet, clean them, then upload a tab-separated file or convert it to XML.One-off launches and catalogs that rarely change.
Script on your own dataA script reads your store or ERP data and writes the XML file on a server.Developers who want rules and timing under their control.
Feed app or platform connectorAn app such as Shopify's Google & YouTube channel or a feed tool syncs products for you.Catalogs that change daily and teams without a developer.

If you planned to push products with a script instead of a file, note that Google's Content API for Shopping was sunset on August 18, 2026. Custom code that sent products through it has to use the Merchant API now. A scheduled XML file is unaffected.

How do you create an XML feed for a Shopify store?

Shopify does not write a Google XML file for you. Its Google & YouTube channel syncs products to Merchant Center directly once your account is connected, and Shopify's requirements page lists what that needs: a store that is not in private mode, a payment provider, a refund policy and terms of service, a verified domain, and for each product a Google product category plus a GTIN, or an MPN and brand. Connecting an existing Merchant Center account through the channel overwrites a feed you already set up there, so plan the switch.

For control over titles and attributes inside that sync, see our guide to Shopify channel mapping for Google & YouTube. If you need an XML file, for example to send the same data to several channels, a feed app is the usual route; our comparison of Google Shopping feed apps for Shopify covers the main options.

What are the most common XML feed errors?

  • Price or availability mismatch. The feed value must match the landing page and checkout, including sale prices. Regenerate the file when prices or stock change and align the fetch time with it.
  • Invalid or guessed GTINs. Google accepts only GS1-valid GTINs, without dashes or spaces. Never invent one; use mpn and brand instead.
  • Malformed XML. Unclosed tags, unescaped ampersands and a missing namespace declaration stop the file from being read.
  • Wrong URL. A link to a web page instead of the file, a blocked folder or expired credentials make the fetch fail.
  • Unsupported file. HTML, PDF or a badly formatted spreadsheet saved with the wrong extension triggers upload errors.
  • Small or watermarked images. Images under 500 x 500 pixels will be a problem from January 31, 2027.

When products are disapproved rather than the whole file failing, work through them by issue type. Our guide to fixing Merchant Center product disapprovals at scale shows how.

Image showing how to keep your product feed healthy over time

How do you improve the feed without editing the XML file?

Once the primary file works, you rarely want to touch it again. A supplemental data source adds or overrides attributes, such as better titles or custom labels, on top of the primary feed by matching on id. Our guide to supplemental feeds in Merchant Center explains the setup.

This is where most of the performance gain sits: a feed that is accepted is not the same as a feed that matches what shoppers search. Clarmix Feed Enrichment starts with a free Merchant Center feed audit that scores each SKU from 0 to 100, then writes AI rewrites of titles, descriptions, Google product categories and product types that you review before anything is sent. Approved changes go through a supplemental feed, so the XML file you built stays untouched. The Feed Enrichment demo video shows the flow.

Frequently asked questions

Can I create a Google Shopping feed manually without an app?

Yes. Write an RSS 2.0 XML file with the g namespace and the required attributes, or a tab-separated sheet, and add it in Merchant Center under Data sources. For a small catalog that changes rarely, uploading the file by hand works; for anything that changes, host it at a URL and schedule a fetch.

Is XML better than a TSV file or Google Sheets?

Merchant Center processes them the same way. XML is easier when you have nested values such as shipping per country or many optional attributes; a TSV file or sheet is easier to edit by hand. Choose the format your tools produce most reliably.

How often does Merchant Center fetch an XML feed?

Once every 24 hours by default. You can change the schedule to daily, weekly or monthly and pick the delivery time. For more frequent updates, trigger a manual fetch, upload a new file or use the Merchant API.

Why is my XML feed not processing?

Check that the URL points directly to the file, that Googlebot and AdsBot-Google can reach it, that the file is UTF-8 and well formed, and that the name in Merchant Center matches the file name. Then check that every attribute carries the g: prefix declared on the root element.

Does the Shopify Google & YouTube app create an XML feed?

No. It syncs products to Merchant Center directly without a file you can download or reuse. If you need an XML file for other channels or for rules the app does not support, use a feed app or a script.

Sources

Join our monthly tips!

Get fresh insights on Google Shopping optimization delivered straight to your inbox.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By clicking Sign Up you're confirming that you agree with our Terms and Conditions.