Google AdSense does not hand you a finished ads.txt file — it provides the exact seller line that belongs inside one, and the rest of the file is built around that single record. The canonical AdSense line is shaped like google.com, pub-XXXXXXXXXXXX, DIRECT, f08c47fec0942fa0, with your actual publisher account ID substituted for the placeholders and the trailing token included only when Google's own instructions supply it. Because the format is fixed by the IAB Tech Lab ads.txt 1.1 specification, every other platform that you work with uses the same shape, just with a different domain, identifier, and relationship. Your job is to take the AdSense record, add it to a plain-text file alongside any other authorized sellers, and host the result at the root of the domain that owns the inventory. A standards-shaped generator such as the Ads Txt Generator handles the field-by-field formatting and duplicate protection while the seller details stay inside your browser, so the file you publish is a syntactically clean spec record rather than a freeform paste.

how to get ads txt from adsense
how to get ads txt from adsense

What "Getting ads.txt From AdSense" Means in Practice

Several publishers expect a single button in the AdSense interface that downloads a ready ads.txt file, but what AdSense actually surfaces is the structured seller line inside the account settings. "Getting" the file means copying that line out of AdSense and assembling the rest of the file around it, then uploading the result to a location crawlers can read. The distinction matters because no crawler cares whether you downloaded the file from AdSense or built it yourself, but every crawler cares that the file exists at the root path with the expected content.

That is also why a generator is useful for the AdSense case in particular. AdSense provides exactly four pieces of information — domain, publisher ID, relationship, certification authority ID — and each one has to land on the correct side of the comma. A paste that drops the pub- prefix, swaps RESELLER for DIRECT, or trails off without a closing newline produces a file that parses but does not match the seller declaration Google expects. Using a generator that checks every field before it writes a line keeps the AdSense record identical to the text inside the AdSense interface, which is the only way to be sure the declaration lines up.

The AdSense Seller Line: Required and Optional Fields

The AdSense record is the same shape as any other authorized-seller row, with the four positions held by Google's specific values. The table below breaks the canonical line into its parts so that you can match each piece against the source text inside your AdSense account before you paste it into a generator.

PositionFieldAdSense exampleWhat to do with it
1Advertising system domaingoogle.comEnter as a bare lowercase host. No scheme, path, port, username, or trailing slash.
2Publisher account IDpub-XXXXXXXXXXXXCopy the full value as it appears in AdSense, including the pub- prefix and digits.
3RelationshipDIRECTUse DIRECT when your own AdSense account sells the inventory directly.
4Certification authority IDf08c47fec0942fa0Optional. Include only when Google's published instructions give you the exact token.

Two formatting rules do most of the work. The first field must be a bare DNS-style host, which is why the generator lowercases the value and rejects schemes, paths, ports, and credentials instead of silently extracting a host from a pasted URL. The second field is the value AdSense assigns to your account, which always begins with the pub- prefix followed by digits for Google seller accounts. Other exchanges use different identifier shapes entirely, so never reuse the AdSense format for a non-Google seller and never invent an identifier a platform has not given you. The fourth field is the one publishers most often get wrong, because Google's published example includes a specific token that does not apply to every entry: leave it blank unless the platform's own instructions provide the exact value.

DIRECT vs RESELLER for an AdSense Record

The relationship field is a single word that completely changes the meaning of the record. It is not a styling preference or a regional option; it is a factual declaration about who controls the listed account, and buyers read it as such. For your own AdSense publisher account the only accurate value is almost always DIRECT, because you are the party that signed up, controls the account login, and holds the contract with Google. RESELLER applies when an authorized partner — for instance an ad network, an exchange, or a header-bidding wrapper — sells your inventory under its own seller identifier on an advertising system that is not its own.

AspectDIRECTRESELLER
Account controlYou control the listed seller accountAnother authorized entity controls it
Contract with the ad systemYou hold it directly with the systemThe third party holds it with the system
Typical AdSense useYour main AdSense accountA partner network reselling through AdSense's inventory (rare for a publisher's own ID)
Risk of misuseLowest, because it matches the account you sign in toMislabeling a third party as DIRECT, or putting your own AdSense ID on a RESELLER row

If you ever see a RESELLER row that contains your own AdSense pub- identifier, treat it as a mistake: you have just declared that someone else controls your AdSense account. Keep your own AdSense ID on a DIRECT line, and put partner identifiers on RESELLER lines alongside any other sellers they authorize.

Build Your ads.txt With the Ads Txt Generator

  1. Open the Ads Txt Generator in your browser. The page runs locally and does not send account details to a server, so you can paste real seller records without a sign-in step.
  2. Copy the AdSense seller line from your account or from the AdSense setup instructions. Confirm the four pieces: the google.com domain, your pub- account ID, the relationship, and the optional certification authority ID.
  3. Add the AdSense record first. Use a bare google.com (no scheme, path, or trailing slash), paste the full publisher account ID exactly as AdSense shows it, set the relationship to DIRECT, and include the certification authority ID only when Google's instructions specify it.
  4. Add each additional authorized seller in the same way, one platform-supplied record at a time. Different exchanges use different identifier styles, so copy each value rather than reusing the AdSense format.
  5. Review the rendered list for typos or exact duplicates. The generator trims surrounding whitespace, rejects commas or spaces inside fields, normalizes domain case, prevents exact duplicate rows, and ends the file with a newline.
  6. When every seller is in the list, copy the assembled text or download the file. The output is newline-terminated and ready to publish at /ads.txt on your root domain.

For a slightly different ordering of the build and publish steps, the practical guide to creating an ads.txt file covers the same workflow through a generic site lens and pairs naturally with the field-level table above when you are managing several platforms.

Validate the Output and Download the File

Once each seller is in the list, the generator renders one comma-separated line per record and treats any stray paste of a full URL, a comma inside a field, or a leftover whitespace as a problem to fix rather than as silent noise. The page validates syntax — it cannot log in to AdSense, confirm that a publisher ID belongs to you, prove that a partner is allowed to resell your inventory, or detect every platform that buys your impressions. Treat the output as syntactically correct by construction, and review each rendered line against the source instructions inside the relevant platform account before you deploy.

The generator supports up to 200 records so a single mistaken oversized paste cannot produce an unwieldy browser tab, and it ends the file with a newline, which the IAB Tech Lab ads.txt 1.1 specification expects and which avoids "no newline at end of file" warnings from editors and CDNs. Use either the copy button or the download action. Downloading gives you a local ads.txt file you can open in any text editor, scan against your AdSense instructions, and back up before publishing. When you are updating an existing file, do not remove previous valid sellers merely to add a new one — append the new record, keep the rest of the file intact, and treat the change as a deliberate diff.

Publish at /ads.txt and Verify in the Browser

The downloaded file has no effect on its own. It only counts once it is reachable as plain text at the root of the domain that owns the inventory, which for a site hosted on example.com means a public URL of https://example.com/ads.txt. Hosting the file only under /files/ads.txt, embedding it inside an HTML page, or placing it behind authentication does not create the same root resource, and crawlers will treat the declaration as missing even though the bytes are technically online. Serve the file with a text/plain content type so it is read as a spec-compliant ads.txt resource rather than as HTML.

After deployment, open the public URL in a browser using the View Source command or the developer-tools Network panel so you see the raw bytes the crawler will see. Walk through each line and compare it character-for-character with the AdSense instruction text inside your account. The expected line is exactly google.com, pub-XXXXXXXXXXXX, DIRECT, f08c47fec0942fa0, with your real identifier substituted for the X block and the trailing certification authority ID omitted unless Google's instructions include it for your case. Account changes, new resellers, or platform rebrandings will require future updates, so keep a backup of the prior file and treat each modification as a reviewable diff until the next crawler fetch confirms the edit is live.