ads.txt for AdSense: what it is, where it goes and how to check it
A one-line text file that decides whether advertisers trust your ad slots. What to put in it, the ca-pub mistake almost everyone makes, where the file must live, and how to verify it.
By Angga Pratama · Published December 5, 2026
On this page
ads.txt is the smallest file on most websites and one of the easiest to get wrong. For an AdSense site it is usually a single line. Get that line wrong, or put the file in the wrong place, and AdSense shows an "Earnings at risk" warning in your account.
This guide explains what the file does, what goes in it, where it has to live, and how to check it. It is based on adding ads.txt to astu.app and on the ads.txt check I added to the AdSense Readiness Checker.
What ads.txt does
ads.txt stands for Authorized Digital Sellers. It is a public standard from the IAB Tech Lab. The idea is simple: you publish a list of the companies that are allowed to sell ad space on your domain.
Advertisers and ad exchanges read that list before they buy. If someone tries to sell ads while pretending to be your site, their account is not on your list, so buyers can skip them. That protects advertisers from fraud and protects your earnings from counterfeit inventory.
For a site that only uses AdSense, the list has one entry: Google, with your publisher account.
Do you need it before AdSense approves your site?
No. You can apply and get approved without an ads.txt file. Once ads start serving, AdSense checks for it and shows an "Earnings at risk" alert if it is missing or has no line for your account.
Adding it early does no harm, because your publisher ID exists as soon as you sign up. I added astu.app's file while the site was still waiting for its next review, so there is one less thing to fix after approval.
The line, field by field
- Ad system domain:
google.comfor AdSense. Notadsense.comorgooglesyndication.com. - Publisher ID: your account ID,
pub-followed by 16 digits. - Relationship:
DIRECT, because you own the AdSense account.RESELLERis for accounts that sell on your behalf, such as some ad management companies. - Certification authority ID:
f08c47fec0942fa0. It identifies Google in the Trustworthy Accountability Group, and it is the same for every AdSense publisher.
You can also copy the exact line from your AdSense account: it shows the snippet for your publisher ID when it asks you to fix ads.txt.
The ca-pub mistake
Your AdSense ad code contains your ID as ca-pub- followed by 16 digits. In ads.txt the ID is written without ca-. It is the most common error I see: someone copies the client ID from the ad code, pastes it into ads.txt, and the line never matches.
If you are unsure, look at your ad code, take the 16 digits, and write pub- in front of them.
Where the file has to be
Crawlers request one address: https://your-domain/ads.txt. The file has to:
- Sit at the root of the domain, not in a folder such as
/blog/ads.txt. - Return a normal 200 response, not a redirect chain to another domain or an error.
- Be plain text. Some hosts answer every unknown path with an HTML page and a 200 status. That page is not an ads.txt file, even though the address loads. The astu.app checker ignores HTML responses for exactly this reason.
- Be named exactly
ads.txt. On Windows it is easy to saveads.txt.txtwithout noticing, because the extension is hidden.
How to add it
The file is the same everywhere. Only the upload step differs.
- Static sites and frameworks (Next.js, Astro, Hugo, Vite, plain HTML): put
ads.txtin the folder that is served at the root, usuallypublic/orstatic/, and deploy. - WordPress: upload the file to the site's root folder with your host's file manager or FTP, next to
wp-config.php. Some SEO and ad plugins can manage it for you, but only use one method, or they overwrite each other. - Blogger: turn on the custom ads.txt option in the Monetization settings and paste the line.
For astu.app, a Next.js site, the whole change was one file at public/ads.txt:
google.com, pub-7151170143190352, DIRECT, f08c47fec0942fa0
The publisher ID is not a secret. It is already visible in the source of every page that loads AdSense.
How to check it
- Open the address in your browser.
https://your-domain/ads.txtshould show your line as plain text, with no page layout around it. - Run the AdSense Readiness Checker. It now requests your ads.txt, lists the Google publisher IDs it finds, and flags
google.comlines that are malformed. It does not affect the score, because the file is not needed to apply. - Check the Sites page in AdSense after approval. Google can take a few days to notice a new or changed file, so a warning right after an update is normal.
This is what the checker reported for astu.app before the file was published:

The checker run on astu.app before the file went live. ads.txt is reported separately and does not change the score.
Common mistakes
- Using
ca-pub-instead ofpub-. Covered above, and still the top one. - Overwriting other networks' lines. If you use more than one ad network, each one gives you lines to add. Replacing the whole file with only the Google line removes the others and can cut their revenue.
- Adding other people's publisher IDs. Copying a "complete" ads.txt from another site authorizes their accounts on your domain. List only accounts you or your partners actually use.
- Typos in the relationship.
DIRECTandRESELLERare the only valid values. - Forgetting the file after moving hosts. A new host or a new theme can drop files from the root. After any migration, open
/ads.txtagain.
Questions people ask about ads.txt
Is ads.txt required to get AdSense approval?
No. It matters once ads are serving. Before that it is optional, but adding it early is harmless and saves a step later.
Where do I find my publisher ID?
In your AdSense account settings, or in your ad code: take the 16 digits after ca-pub- and write pub- in front of them.
How long does AdSense take to detect a new ads.txt?
Usually a few days. If the warning is still there after a week, open the file in a browser and check the exact line again.
Can one ads.txt list several ad networks?
Yes. Add one line per network and account. Many sites have dozens of lines. Only add lines that the networks you work with give you.
What if my site is on a subdomain?
AdSense generally looks for the file on the root domain. If your site lives on a subdomain such as blog.example.com, check the ads.txt section of your AdSense account, which tells you where it expects the file for your setup.
Does ads.txt affect SEO?
No. Search engines do not use it for ranking. It is only read by advertising systems.