ads.txt syntax for AdSense, line by line: pub ID, DIRECT, TAG ID, comments and variables
Key takeaways
- The AdSense ads.txt record is google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0, where pub-0000000000000000 is replaced by your own publisher ID.
- Field 2 must contain only the pub- prefix and the 16-digit number; Google says to delete product prefixes such as ca- or ca-video-.
- f08c47fec0942fa0 is Google's Trustworthy Accountability Group (TAG) certification ID, the same value Google lists as TAG-ID in its sellers.json file.
- In the IAB Tech Lab ads.txt 1.1 specification, lines starting with # are comments and lines in the form VARIABLE=VALUE are variable declarations such as CONTACT, SUBDOMAIN, OWNERDOMAIN and MANAGERDOMAIN.
- If you monetize through several AdSense or Ad Manager accounts, Google requires a separate ads.txt row for each account with its own pub- code.

An AdSense ads.txt file needs one line: google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0, with your own publisher ID in place of the zeros. The four comma-separated fields are the ad system’s domain, your account ID in that system, the relationship type and Google’s certification ID. Everything else in the file (comments, other networks, variables) follows the IAB Tech Lab ads.txt 1.1 specification.
What does the AdSense ads.txt line look like?
The Ads.txt guide in the AdSense Help Center gives this exact format, where pub-0000000000000000 is replaced by your own publisher ID:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
You do not need to type it. In AdSense, open “Sites”, select the site, choose the “Ads.txt snippet” option and click “Copy”. Copying from AdSense avoids the most common error: a mistyped publisher ID.
What does each field mean?
The IAB Tech Lab ads.txt 1.1 specification defines three required fields and one optional field. Google’s Ads.txt FAQs map them to AdSense values.
| Field | Spec name | AdSense value | Notes |
|---|---|---|---|
| 1 | Domain name of the advertising system | google.com |
Google says that for Google seller accounts, the domain name is always google.com. |
| 2 | Publisher’s Account ID | pub- + 16 digits |
Must match the ID used in bid requests (publisher.id in OpenRTB). |
| 3 | Type of Account/Relationship | DIRECT |
DIRECT if you control the account, RESELLER if someone else does. Case-insensitive. |
| 4 | Certification Authority ID | f08c47fec0942fa0 |
Optional in the spec, included in Google’s snippet. |
Field 1: google.com
This is the canonical domain of the system that bidders connect to. Do not write adsense.com, googlesyndication.com or www.google.com. For any Google seller account (AdSense, Ad Manager, AdMob), the value is google.com.
Field 2: your publisher ID
Your publisher ID looks like pub-1234567890123456. You find it in AdSense under “Account”, then “Settings”, then “Account information”, in the “Publisher ID” field (Find your publisher ID). It also appears in your ad code as ca-pub-1234567890123456.
That ca- prefix is the trap. Google’s FAQ is explicit: “Only include the pub- prefix and the 16-digit numeric code in your declaration. Delete the product-specific prefix (for example, ca- or ca-video-).” A line with ca-pub-... will not match your seller account.
Field 3: DIRECT
Google states that publishers who directly control the account in field 2 should specify DIRECT. RESELLER means you authorized another entity to control that account and resell your inventory, for example an Ad Manager account using Scaled Partner Management for inventory it does not directly manage. A standard AdSense publisher always uses DIRECT.
Field 4: f08c47fec0942fa0
This is the ID of the advertising system (Google) at a certification authority, the Trustworthy Accountability Group (TAG). It is the same for every AdSense publisher. You can see it in Google’s own sellers.json, which lists an identifier named TAG-ID with the value f08c47fec0942fa0.
The spec marks field 4 as optional and notes that certification IDs are “superseded by the identifiers object in sellers.json” and that the field “may be deprecated in a future version”. Some Google pages show the line with only three fields; the crawl troubleshooting page uses google.com, pub-0000000000000000, DIRECT as its example. Keep the four-field version that AdSense gives you: it is what the “Ads.txt snippet” produces and it is valid under every spec version.
How do comments, blank lines and whitespace work?
The specification borrows its simplicity from robots.txt. The rules that matter in practice:
- Comments. Anything after a
#, to the end of the line, is ignored. A full line starting with#is a comment line. - Whitespace. Consumers “should ignore any sequence of whitespace or tabs” between fields, so
google.com,pub-...andgoogle.com, pub-...are equivalent. No field may contain whitespace, commas or tabs itself. - Line endings. Records are separated by line breaks, and consumers should accept CR, LF or CRLF.
- Extension fields. Implementers may add extension data after a
;separator at the end of a record. AdSense does not ask you to add any.
A small, valid file with a trailing comment and a second network looks like this (the second line is a placeholder for whatever line your other network documents):
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0 # AdSense
othernetwork.example, 12345, DIRECT
For every network other than Google, take the line from that network’s own documentation. The spec says publishers should consult each SSP or exchange for its canonical domain and the ID to use.
What variables does ads.txt 1.1 support?
Any line matching VARIABLE=VALUE is a variable declaration. Version 1.1 (final release July 2022 according to the spec’s change log) lists five supported variables:
| Variable | Purpose | Needed for AdSense? |
|---|---|---|
CONTACT |
Human-readable contact for the file owner (email, phone, form URL) | Optional |
SUBDOMAIN |
Points crawlers to a subdomain that has its own ads.txt | Only if a subdomain has different sellers (see ads.txt and subdomains) |
INVENTORYPARTNERDOMAIN |
Points to a partner domain that owns inventory inside your site or app, mainly CTV | Rarely |
OWNERDOMAIN |
Business domain of the entity that owns the site | Recommended by IAB, see OWNERDOMAIN and MANAGERDOMAIN |
MANAGERDOMAIN |
Business domain of an exclusive or primary monetization partner | Only if someone else sells your inventory |
The spec recommends placing variables at the end of the file for readability, but says crawlers must not assume that order. A file with variables:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
contact=adops@example.com
ownerdomain=example.com
The spec’s own examples write variables both in lowercase (contact=, subdomain=) and in uppercase (OWNERDOMAIN=, MANAGERDOMAIN=). Google’s AdSense help pages document only subdomain=; they do not say whether AdSense reads OWNERDOMAIN, so treat it as information for buyers rather than something AdSense verifies.
What if I use several AdSense or Ad Manager accounts?
Each seller account needs its own line. Google’s FAQ: “If you monetize through multiple Ad Manager and/or AdSense accounts, you must include a separate row for each account, with its corresponding pub- code.” Two lines with the same google.com domain and different pub- IDs are normal.
Do not list accounts that are not yours or that no longer sell your inventory. ads.txt is an authorization list: every line is permission to sell.
What does a “no sellers” file look like?
If a domain should not have any authorized sellers (a staging domain, for example), the spec deprecated the old empty-file method and asks for this placeholder record instead:
placeholder.example.com, placeholder, DIRECT, placeholder
Never use it on a domain where you show AdSense ads: it declares that nobody, Google included, is authorized.
Which formatting errors break an ads.txt file?
Google’s crawl troubleshooting page warns that “invalid whitespace characters, may be difficult to detect but can make an ads.txt file difficult to parse by a crawler, and the file might be ignored.” The usual culprits:
| Mistake | Example | Fix |
|---|---|---|
| Product prefix in field 2 | ca-pub-1234... |
Use pub-1234... |
| Wrong number of digits | 15 or 17 digits | Copy the ID from “Account information” |
| Typographic characters | Smart quotes, non-breaking spaces, a byte order mark from a word processor | Recreate the file in a plain text editor |
| Rich text pasted | Copied from a document or email with formatting | Google advises a plain text editor and suggests a HEX editor to find invalid UTF-8 |
| Extra commas or fields | google.com,, pub-... |
One comma between each field |
| HTML instead of text | Your CMS returns a themed page at /ads.txt | See ads.txt Not found or Unauthorized |
| Wrong file name | Ads.txt, ads.txt.txt |
Exactly ads.txt, lowercase, at the root |
The specification also requires the file to be served with Content-Type: text/plain, and says other content types “should be treated as an error and the content ignored”. Most servers do this automatically for a .txt file.
How to check your syntax quickly
- Open
https://yourdomain.com/ads.txtin a browser. Google says that if the file displays, “it’s likely that AdSense will successfully find it.” - Compare the Google line character by character with the snippet in AdSense.
- Look for invisible characters, for example with
curl -s https://example.com/ads.txt | od -c | headon macOS or Linux; anything other than letters, digits, punctuation, spaces and\nor\rdeserves a look. - After a fix, use “Check for updates” on the site’s page in AdSense. Google says changes can take a few days, and up to a month for sites with few ad requests.
For automated checks across many domains, see validating ads.txt with open-source tools.
Frequently asked questions
What does f08c47fec0942fa0 mean in the AdSense ads.txt line?
It is the optional fourth field, the certification authority ID of the advertising system. For Google it is the Trustworthy Accountability Group (TAG) ID, and Google publishes the same value as TAG-ID in its sellers.json file. It identifies Google as the ad system, not your account, so every AdSense publisher uses the same value. Your own identity is in field 2, the pub- ID.
Should I write ca-pub or pub in ads.txt?
Use pub- followed by the 16 digits. Google's Ads.txt FAQs say to include only the pub- prefix and the 16-digit numeric code and to delete product-specific prefixes such as ca- or ca-video-. The ca-pub- form you see in the ad code (data-ad-client) is the product-prefixed version of the same ID and does not belong in ads.txt.
Is DIRECT or RESELLER correct for AdSense?
DIRECT, if you own the AdSense account. Google says publishers who directly control the account named in field 2 should specify DIRECT, and RESELLER is for accounts the publisher does not directly control, such as an Ad Manager account using Scaled Partner Management. The field is case-insensitive under the IAB specification, but writing it in capitals matches every official example.
Can I add comments to my ads.txt file?
Yes. The IAB Tech Lab specification says anything after a # character, to the end of the line, is ignored by consumers. You can use full comment lines or trailing comments after a record. Keep comments in plain ASCII text to avoid invisible characters that might make the file harder to parse.
Sources
- Ads.txt guide · Google AdSense Help
- Ads.txt FAQs · Google AdSense Help
- Ensure your ads.txt files can be crawled · Google AdSense Help
- Find your publisher ID · Google AdSense Help
- Ads.txt Version 1.1 · IAB Tech Lab
Related guides
- How to fix the AdSense "Earnings at risk" ads.txt alert
Why AdSense shows the Earnings at risk ads.txt alert, what Not found and Unauthorized really cost you, and how to fix it and get the warning cleared faster.
- ads.txt "Not found" or "Unauthorized": a technical checklist for redirects, HTTPS, status codes and robots.txt
Diagnose ads.txt Not found and Unauthorized statuses: root vs www, HTTP vs HTTPS, redirect rules, 404 and soft 404, robots.txt, content type, with curl tests.
- OWNERDOMAIN and MANAGERDOMAIN in ads.txt 1.1: syntax, when to add them, and sellers.json consistency
What the OWNERDOMAIN and MANAGERDOMAIN variables in ads.txt 1.1 mean, the exact syntax, when an AdSense publisher should add them, and how they tie to sellers.json.
- Validating ads.txt yourself: curl checks, the IAB Tech Lab open-source crawler and scripted audits
Check your ads.txt without third-party validators: curl tests that mimic a crawler, the IAB Tech Lab open-source crawler and its limits, and a short audit script.
- Google's sellers.json for AdSense publishers: seller information visibility and what buyers see
What Google's sellers.json says about your AdSense account, how the Seller information visibility setting works, and how to find your own entry in the file.