Home / Tools / AdSense
✦ AdSense

ads.txt generator & validator

Build a correct ads.txt from your AdSense publisher ID and your other ad partners, or paste the file you have and see every line that buyers and crawlers would misread.

Your sellers

Every company allowed to sell ads on your site gets one line.

Paste pub-… or ca-pub-…. ads.txt needs the pub- form. Find it in AdSense under Account → Settings → Account information.

Other sellers optional

Quick add a common partner, then fill in the account ID your partner gave you.

Domains in the list are the ones these partners usually use. Always copy the exact line (ID, DIRECT or RESELLER, certification ID) from your partner's dashboard or docs.

Copied into the file as they are, and checked below.

Variables

Optional lines from the IAB ads.txt 1.1 spec.

The business that owns the site, as a root domain (not a URL).

Email, phone or contact page for the file owner.

Only if another company is your primary or exclusive seller.

Two-letter ISO country code.

Subdomains with their own ads.txt. Separate several with commas. Only put these on the root domain's file.

Your ads.txt

Upload it as ads.txt to the root of your domain, e.g. https://example.com/ads.txt.

After you upload it

  1. Open https://yourdomain.com/ads.txt in a browser. You should see the plain text, not an error page or a redirect to your home page.
  2. The server should send it as text/plain. The spec tells crawlers to ignore other content types.
  3. In AdSense, open Sites, pick the site and click Check for updates. Google says changes can take a few days, or up to a month for low-traffic sites.

Check an existing ads.txt

Paste the content of your ads.txt or app-ads.txt. Nothing is uploaded.

Result

Paste a file on the left to check it line by line.

How an ads.txt file works

ads.txt (Authorized Digital Sellers) is an IAB Tech Lab standard. It is a plain text file at /ads.txt on your root domain that lists every ad system allowed to sell your inventory, so buyers can spot sellers that only pretend to represent your site.

Each seller line has three comma-separated fields and an optional fourth: the ad system's domain (e.g. google.com), your account ID on that system, the relationship (DIRECT if you control the account, RESELLER if someone else sells for you) and the certification authority ID (the system's TAG ID). Text after # is a comment.

For AdSense the line is always google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0, with your 16-digit ID. The ad code uses ca-pub-, but ads.txt does not: Google Ad Manager's validator flags the ca- prefix as an error.

Variable lines use NAME=value. Version 1.1 of the spec supports CONTACT, SUBDOMAIN, INVENTORYPARTNERDOMAIN, OWNERDOMAIN and MANAGERDOMAIN. If you don't want any seller, publish the placeholder line placeholder.example.com, placeholder, DIRECT, placeholder rather than an empty file.

Apps: app-ads.txt uses the same format. It goes on the developer website listed in your Google Play or App Store listing, at /app-ads.txt, and this generator and validator work for it too (save the file as app-ads.txt).

Frequently asked questions

Is ads.txt required for AdSense?

Google calls it optional but highly recommended. Without one, the site's ads.txt status in AdSense shows as Not found, and buyers can't tell your real inventory from counterfeit inventory.

Should I use pub- or ca-pub- in ads.txt?

Use pub- followed by your 16 digits. ca-pub- belongs in the ad code only. Google Ad Manager tells you to delete the product prefix (ca- or ca-video-).

What is f08c47fec0942fa0?

It is the certification authority (TAG) ID for google.com, the optional fourth field. Google's own ads.txt line includes it, so keep it on every google.com line.

DIRECT or RESELLER?

DIRECT means you control the account named in the line. RESELLER means you let another company sell your space through its account. If the same account appears as both, Ad Manager says you can usually remove the RESELLER line when you own the inventory directly.

How long does AdSense take to see my ads.txt?

Google says a few days, or up to a month if your site makes few ad requests. Use Check for updates on the Sites page to ask for a recheck.

Do subdomains need their own ads.txt?

Only when a subdomain has different sellers. Then put an ads.txt on that subdomain and list it on the root domain with subdomain=shop.example.com. Otherwise crawlers use the root domain's file.

More free tools