Ads.txt Generator — Create a Valid ads.txt File

Publishers and ad ops teams create this file when a site begins serving programmatic ads, because demand partners read it before they decide to bid. The generator writes IAB standard ads.txt lines with DIRECT and RESELLER relationships, optional cert_id fields, and custom variable declarations. Each line records which account IDs may sell inventory on your domain, and buyers skip any seller that does not appear. The file also blocks domain spoofing, and Google AdSense and Ad Exchange require it on every site that runs their demand.

How It Works

  1. Enter each seller record

    Type the system domain, the publisher account ID, and the relationship: DIRECT for accounts you own, RESELLER for partners selling on your behalf. Add a cert authority ID when the exchange supplied one, and an optional comment if you want the line explained inside the file.

  2. Add variables and a header

    Use Add variable for each ad tech key your partner asks you to declare, and type any context you want printed at the top into the header comment box. Untick Include comments when the file has to stay free of notes.

  3. Watch the output refresh

    The output box rebuilds on every keystroke, the stats line reports the record and line counts, and the error box names the field that still needs a value before the file passes.

  4. Copy the file to your root

    Press Copy, save the text as ads.txt, and upload it to the root of the domain so it answers at https://example.com/ads.txt. Repeat for each subdomain that runs its own ad setup.

Preset examples
The file builds in your browser as you type.

A DIRECT relationship for your own seller account plus a RESELLER entry with a cert authority ID.

Seller records
Record 1
Custom variables
—

Before and After: what a thin ads.txt file misses

The file below is what a hand edit usually produces: one line, no reseller entries, and nothing that says which account belongs to the publisher. Exchanges that never appear in the file cannot bid on the inventory, and a reviewer has no way to tell a direct account from a partner account.

Before (single DIRECT line, no reseller entries, no cert context)
# ads.txt
google.com, pub-123, DIRECT
After (publisher, AdSense, and a reseller with cert_id)
# Ad demand sources for example.com
example.com, 11223344, DIRECT
google.com, pub-999999999999, DIRECT
openx.net, 5332, RESELLER, cert_id=68a1f6ce1b0e4b34

The second file adds the reseller relationship and the cert ID that exchange asks for, plus a header comment explaining why the file exists. Parsers ignore every comment line, so the extra context costs nothing at bid time while making the file easier for a teammate to audit. Coverage is the real difference: a seller missing from the file is dropped during bidding, and that missing line is what a spoofing attempt exploits when it claims a domain it does not own.

Use Cases

One file gets read by three different audiences, and each of them checks something else. The rows below pair a concrete situation on each side with what that side cares about.

Developer Production Workflow
Validating a CI-generated ads.txt before the deploy job uploads it Serving the file at the root domain so buyers resolve it in one request Agency managing 40 publisher accounts from one shared line template
Diffing yesterday’s file against today’s after an ad stack change Adding a RESELLER line the day a new SSP signs the contract Ad ops reviewing seller IDs before a quarterly partner audit
Running a syntax check on a file that a non-engineer edited Keeping AdSense serving through a subdomain or domain move Onboarding a new site onto the demand partners list
Asserting in a test that the DIRECT line for the main account exists Dropping a departed partner account ID the week the contract ends Network standardizing cert_id usage across every property

Frequently Asked Questions

What is ads.txt and why does it exist?

ads.txt is a plain text file a publisher places at the root of its domain to list the companies allowed to sell its ad inventory. The name stands for Authorized Digital Sellers, and the format is maintained by the IAB Tech Lab. Each line names a system domain, a seller account ID, and a relationship value, and some lines add a certification ID. Demand partners crawl the file before bidding, so a missing line turns into revenue that never arrives.

What is the difference between DIRECT and RESELLER?

DIRECT marks an account ID that belongs to you, meaning the publisher sells its own inventory with that account. RESELLER marks a third party, such as an SSP or an aggregator, that you have authorized to sell on your behalf. Both kinds live in the same file, one line per account, and a site commonly carries a mix of the two. A partner left out of the file is the usual reason that partner reports no impressions on your domain.

What is a cert_id and when do I need one?

A cert_id is the certification authority ID that some exchanges use to verify a seller account behind a reseller relationship. It sits at the end of a line as cert_id= followed by the identifier the exchange issued to the partner. Only add it when the exchange actually supplies one, because an invented or outdated ID creates more doubt than an empty field. Lines without a cert_id stay valid under the IAB format, so plain DIRECT and RESELLER entries cover most publishers.

Where do I place the ads.txt file?

The file belongs at the root of the domain that serves the ads, which means https://example.com/ads.txt is the address a crawler expects to fetch. A subdomain with its own ad setup needs its own copy at blog.example.com/ads.txt, and the same rule applies to every other subdomain that runs ads. Serve it as plain text with a normal 200 response and no redirect, login wall, or content negotiation. Most hosting setups already return a .txt file from the site root without any extra configuration.

How does Google use ads.txt for AdSense and Ad Exchange?

Google checks ads.txt before serving ads on a site, and an AdSense account stops serving when the file is missing or the DIRECT line for the publisher ID is absent. Partner demand appears under the exchange system domain as RESELLER lines rather than under your own domain. Google re-crawls on a schedule, so a correction takes effect at the next crawl instead of immediately. Keeping the file accurate also stops the site from being listed in reports for inventory someone else claims to sell.

What are custom variables in ads.txt?

A custom variable is a declaration a vendor asks you to add so its integration can read a configuration key from the same file. The generator prints each one as a comment line in the form # smaato-variable: smaato, which crawlers skip while the partner tooling picks it up. Add a variable only when a partner setup guide asks for one, and leave the section empty otherwise. Names must start with a letter and may contain letters, digits, hyphens, and underscores.

How often should I update ads.txt?

Update the file whenever you add a partner, drop a partner, or move a seller account to a new ID. Teams running seasonal demand changes edit it several times a quarter, and usually a single line changes. After publishing, fetch the live URL to confirm the network sees the new text, because a CDN can serve an older copy for a while. Removing a line matters as much as adding one, since a stale entry still authorizes an account you no longer work with.