Skip to content
Menu
Web

ads.txt for Websites: Setup and Not Found Fixes

What an ads.txt file is, the exact AdSense line, where it goes on WordPress, Blogger, Shopify and static sites, and how to clear a Not found status.

12 min read · Updated

An ads.txt file is a plain text file at yourdomain.com/ads.txt that lists the companies allowed to sell ads on your site. For AdSense it needs one line, which AdSense gives you: google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0, with your own publisher ID in place of the zeros. If AdSense says "Not found", the crawler visited your site and could not retrieve a file at that address.

The fix is usually small. Create a text file, paste the line, upload it to the root of the domain, open the URL in a browser to check it loads, then wait. Google says changes can take a few days to show up in AdSense, and up to a month on a site that makes few ad requests.

Ads.txt is not mandatory, and Google describes it as highly recommended. A status of "Unauthorized" is more serious: AdSense says all ad requests from the site are being rejected because your publisher ID is not in the file. Below are the format, the placement rules, the platform quirks (WordPress, Blogger, Shopify and plain hosting), and the reasons a file that looks fine still reads "Not found".

What the file actually does

Advertisers buy through exchanges and resellers, and some middlemen sell inventory they have no right to sell. Ads.txt (Authorized Digital Sellers) is the publisher's answer: a public list, on the publisher's own domain, of who may sell the site's ad space. A buyer's system can fetch your file and compare it with the seller named in a bid request. If the seller is not listed, the buyer can skip it.

The standard comes from IAB Tech Lab. The current version is 1.1, published in 2022, and it is modelled on robots.txt: the file proves its own authenticity by living on your web server, since only someone who controls the site can put it there.

For a small AdSense site the practical effect is simple. Google's systems read your file, and if your publisher ID is missing, they reject the ad requests. Resellers, certification IDs and subdomain pointers matter mostly once you work with several networks.

This guide is about websites. Apps use a sibling file called app-ads.txt, which lives on the developer website listed in the store listing. We cover that separately for Google Play, the Apple App Store and the Amazon, Samsung and Huawei stores.

The AdSense line, field by field

Each line in the file has up to four fields, separated by commas. Here is the AdSense entry:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
FieldValue in the exampleMeaning
1google.comThe domain of the advertising system that sells your inventory
2pub-0000000000000000Your account ID inside that system. For AdSense, this is your publisher ID
3DIRECTYou own the account yourself. RESELLER means you authorised someone else to sell through their account
4f08c47fec0942fa0Optional certification authority ID. For Google, it is Google's TAG identifier, and you copy it as given

One trap is worth naming. Your AdSense ad code contains your ID with a ca- prefix, as in ca-pub-.... The ads.txt line uses pub-... only. If you build the line by hand from the ad code, the prefix is the first thing to cut off. Better still, never build it by hand: in AdSense, open Sites, pick the site, and click Copy next to the ads.txt snippet. The line in your clipboard is exactly what the crawler expects.

Anything after a # is a comment and ignored. A file with only the AdSense line is valid and complete.

Where the file has to live

Ads.txt goes at the root of your domain, so that opening https://yourdomain.com/ads.txt in a browser shows the text. Not in a folder, not in your theme, not at /files/ads.txt.

The IAB spec defines the root domain as the registrable name, meaning the public suffix plus one label. For blog.yourdomain.com that is yourdomain.com. Crawlers fetch from the root domain first, and Google's AdSense help says the root domain needs to return the file or redirect to it.

A few rules from Google's crawl requirements are worth keeping handy:

  • The response must be HTTP 200. A 404 is treated as "no file", even if the body of the error page happens to contain your line.
  • The file must be reachable over both HTTP and HTTPS. If it exists on only one, redirect the other. A 404 on one protocol can purge entries that were already crawled.
  • The HTTP content type should be text/plain. The spec says other content types should be treated as an error and the content ignored.
  • If your site only works on the www host, redirect yourdomain.com/ads.txt to www.yourdomain.com/ads.txt. Otherwise the crawler never sees the file on the www host.
  • Your robots.txt must not block it. A rule like Disallow: /ads catches the path, and a blanket Disallow: / for Googlebot blocks the crawler altogether. Adding Allow: /ads.txt fixes the first case.
  • Use a plain text editor. Rich text editors can add hidden formatting, and stray characters or invalid UTF-8 can make a line unreadable.

Redirects are allowed within limits. Google supports several redirects as long as each stays inside your root domain, and a single redirect to a destination outside it. The IAB spec says the same. That matters for platforms that host the file on a different domain, which we get to below.

Step by step: adding the AdSense line

  1. Sign in to AdSense and open Sites. Click the site, and look for the ads.txt alert or the Ads.txt snippet verification option.
  2. Click Copy to get your line.
  3. In a plain text editor, paste it into a new file named exactly ads.txt. Watch for ads.txt.txt, which some operating systems create when file extensions are hidden.
  4. If you work with other ad networks, add their lines too, one per line. Each network gives you its own entries.
  5. Upload the file to your site's root directory.
  6. Open yourdomain.com/ads.txt in a browser. You should see the line as plain text.
  7. Back in AdSense, go to Sites, select the site and click Check for updates.

Step 7 is optional. Once the status reads "Authorized", Google says ads should begin to appear within about an hour, assuming the site is ready and ads are set up. If the site was waiting on a review, click Request review at that point.

Platform notes: WordPress, Blogger, Shopify and plain hosting

Where the file goes depends on how your site is built. The principle never changes: /ads.txt on your domain must return the text.

Self-hosted WordPress

You have two options. The first is a physical file: connect over SFTP or your host's file manager, create ads.txt in the web root (usually the folder that holds wp-config.php), and paste your lines. The second is a plugin. Ads.txt Manager, from 10up, adds a Settings > Ads.txt screen and serves the file for you without uploading anything.

Do not use both. The plugin's documentation says that if a physical ads.txt already exists in the web root, the plugin will not read it and your changes in the admin screen will not overwrite it. Rename or delete the old file first, and copy its lines into the plugin.

WordPress.com

If you use WordAds, WordPress.com generates the file for you. To add lines from another network, open the ad dashboard (Jetpack > Monetize, then the Settings tab) and switch on the custom ads.txt option. Sites that run AdSense directly and are not on WordAds need the Ads.txt Manager plugin, or SFTP on a Business or Commerce plan. Plans change, so check the WordPress.com help page before you pay for an upgrade.

Blogger

Blogger handles it through a setting. In Blogger, open Settings, find the Monetization section, turn on Enable custom ads.txt, click Custom ads.txt, paste your line and save. Google's Blogger help says to do this manually if you have integrated AdSense yourself or monetize with third-party providers. Then visit your blog address followed by /ads.txt to confirm.

Shopify

Shopify does not give you a web root to upload into. We could not find an official Shopify help page for ads.txt, and what follows is the method that store owners report in Shopify's community forums, so treat it as unconfirmed and check Shopify's own documentation first. The reported approach is to upload the text file under Settings > Files, copy the file's full URL, and add a redirect from /ads.txt to that URL under Online Store > Navigation > URL Redirects. Because the destination sits on Shopify's file host rather than your domain, it counts as the single redirect outside your root domain that the spec permits. Do not chain a second redirect after it, and test by opening yourdomain.com/ads.txt in a browser.

Static sites, Next.js and your own server

Put the file where static files are served from: in a Next.js project the public folder, so public/ads.txt becomes /ads.txt, and on a plain web server the document root. Behind a CDN or cache, purge it after uploading, or an old 404 may linger.

What the AdSense statuses mean

AdSense shows an ads.txt status for each site on the Sites page. Google defines four.

StatusWhat Google saysWhat to do
Not foundNo ads.txt file was found when the AdSense crawler last crawled the siteCreate the file and upload it to the root
UnauthorizedAll ad requests are being rejected because your publisher ID is not in the fileAdd your AdSense line to every ads.txt file on the site
AuthorizedYour publisher ID was found in the fileNothing
Not applicableA platform manages the file for youNothing

The severity differs. For "Unauthorized", Google states plainly that requests are rejected. For "Not found", it says only that fixing the problem prevents any revenue impact, with no figure. Both cost nothing to fix, so treat both as urgent.

To see what is at stake, take an example site with 50,000 pageviews a month, all from Tier 1 countries. Our benchmark estimates put AdSense at about $7.00 per 1,000 pageviews there, so around $350 a month. These are modelled figures, not a quote. The 50,000 monthly pageviews page shows the range by niche, and the AdSense revenue calculator lets you enter your own traffic mix.

Why it says "Not found" when the file is there

This is the question that brings most people here. The file exists, you can see it in your file manager, and AdSense still disagrees. Work through these in order.

  1. Open the URL in a private browser window. Not through your admin screen or a plugin preview. If it does not show plain text at https://yourdomain.com/ads.txt, nothing else matters yet.
  2. Check the status code. From a terminal:
curl -I https://yourdomain.com/ads.txt

You want to see HTTP/2 200 or HTTP/1.1 200 OK, and a content-type of text/plain. A 301 to the www version is fine if the final response is a 200. A 403, 404 or 5xx is the problem.

  1. Check both protocols. Run the same command with http://. If the plain HTTP address returns 404, add a redirect to HTTPS.
  2. Check the www and non-www versions. One of them should return the file, and the other should redirect to it.
  3. Read your robots.txt. Look for a Disallow that catches /ads.txt.
  4. Look at the filename. ads.txt.txt, Ads.txt and ads.txt with a trailing space all fail on a case-sensitive server.
  5. Think about anything that sits in front of the site. A firewall, security plugin or bot-protection rule can return an error to crawlers while serving you the page normally. A redirect loop or a caching layer holding an old 404 produces the same symptom.

If every check passes, the remaining explanation is time. AdSense does not crawl on demand. Click Check for updates, then leave it alone for a few days. Google's crawl notes also say you should not remove a correctly configured file while you wait.

How long the recheck takes

Google's AdSense help gives two figures: a few days in most cases, and up to a month on a site with few ad requests. A brand-new site with a trickle of traffic probably falls into the second group. Google's Ad Manager documentation says its crawler visits every domain that sends ad requests at least once a day, with changes taking up to 48 hours to apply. That describes Ad Manager, not AdSense, but it explains why a fix is rarely instant.

Short outages are forgiven. A 404 purges entries the crawler had stored, but a soft 404 (a 200 response for a page that does not exist) or a 500 error keeps the old entries for up to five days.

Subdomains and the subdomain= line

If your site runs on yourdomain.com, the root file covers subdomains too, unless you tell crawlers otherwise. You only need a separate file when a subdomain has different authorised sellers or a different publisher ID, for example a shop.yourdomain.com that runs another network.

In that case you do two things. Host an ads.txt file on the subdomain with its own lines, and add a pointer in the root file:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
subdomain=shop.yourdomain.com

Google crawls subdomain files only when the root file references them this way. The spec adds that only root domains should point to subdomains, and subdomains should not point onward to other subdomains. If the subdomain has no file, or the root does not declare it, the root file governs.

Running more than one network

The file grows as your setup does. Adding Ezoic, Media.net or a header bidding wrapper means adding the lines each one provides, and keeping the AdSense line. Replacing the file with the new network's lines is the classic mistake, and it can flip AdSense to "Unauthorized" at the next crawl. Always append, never overwrite.

Three habits keep the file healthy. Put a comment above each block saying whose lines they are, such as # Added for the header bidding test. Remove a network's lines when you leave it. And re-check after a plugin update, theme change or hosting migration, which are the usual moments when /ads.txt quietly starts returning 404.

The spec also supports optional variables written as NAME=value, such as CONTACT and OWNERDOMAIN. None is required for AdSense. Our guides to Ezoic and Media.net cover what each network asks for, and header bidding explains why the list of sellers grows once you add it.

sellers.json, the other half

Ads.txt tells buyers which accounts may sell your inventory. It does not tell them who owns those accounts. That is the job of sellers.json, a file published by the ad system itself, not by you. The seller ID in sellers.json matches the account ID in your ads.txt line, so a buyer can trace a bid back to a named seller.

For AdSense publishers there is one setting to know about. Google's sellers.json lists your 16-digit publisher ID, your seller type and, if you allow it, your name and business domain. By default your details may be hidden. Google's AdSense help says that if your information is not made transparent, advertisers will not be able to see your name, which might affect your revenue, and it does not say by how much.

To change it, go to Account > Settings > Account information in AdSense and choose Transparent under "Seller information visibility". You can add a business domain there as well. Google says your details appear in its sellers.json within 24 hours, and the setting applies across AdSense, AdMob and Ad Manager. A name change on the payments profile triggers an automatic two-week payment delay, so decide on the name before you start. Going public is a privacy trade-off, and some small publishers reasonably prefer to stay hidden.

Common questions

Do I need ads.txt if I only use AdSense Auto ads?

Yes. Auto ads still run on your AdSense account, so the same file applies. If your ID is missing, Google's "Unauthorized" status means requests are rejected.

Is the file the reason my AdSense application is stuck?

Rarely. Approval depends on content and policy, and the ads.txt alert is separate. Our AdSense approval checklist covers what reviewers look at, and if ads stopped suddenly, why ad accounts get limited lists the usual causes.

What to check this week

Open yourdomain.com/ads.txt right now, in a private window, and look at it. Then run curl -I on the HTTP and HTTPS versions, and check both the www and non-www addresses. Five minutes catches most of the problems above.

Then open Sites in AdSense and read the status. If it says "Not found" or "Unauthorized", fix the file, click Check for updates, and set a reminder for a week out. If the status is "Authorized", save a copy of the file somewhere outside the server, so a migration never leaves you rebuilding it from memory.

The IAB Tech Lab specification for ads.txt 1.1 is the final reference for fields, variables and redirects. Google's pages on creating the file, making sure it can be crawled and declaring subdomains are the ones to check against your status. If you are weighing another network, AdSense or Mediavine and the AdSense vs Ezoic comparison show what changes, and ad networks for small websites lists options with no traffic minimum.