Skip to the tool
OnPageKit

Ads.txt Generator

Generate and validate the IAB ads.txt file for your domain.

pub- and 16 digits

Fills in the Google line for you: domain, DIRECT and the TAG ID are the same for every publisher.

Other ad systems

optional
optional
one per line
optional
0 record(s)

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

What this tool does

This ads.txt generator writes the authorisation file that tells programmatic buyers who is allowed to sell advertising on your domain. Fill in your AdSense publisher ID and it produces the Google line in full; add the partners you work with, a contact address and any subdomains that serve their own inventory, and it assembles the file. The second tab does the opposite job: paste the file you already publish and it reports, line by line, what a parser makes of it.

Everything happens in this tab. Your publisher ID is not a secret — it is visible in the ad code on every page you serve — but there is still no reason for it to travel anywhere.

The format, in one paragraph

Each line is one authorisation, with fields separated by commas: the ad system's bare domain, your account ID inside that system, the word DIRECT or RESELLER, and optionally the seller's TAG certification ID. Anything after a # is a comment. Lines shaped NAME=value are variables, and only five are defined: CONTACT, SUBDOMAIN, OWNERDOMAIN, MANAGERDOMAIN and INVENTORYPARTNERDOMAIN. There is no nesting, no quoting and no escaping. That simplicity is the point — a buyer's crawler has to parse millions of these files quickly — and it is also the trap, because a malformed line is skipped in silence rather than reported.

Why the file exists at all

Before ads.txt, an exchange had no cheap way to know whether the seller offering your inventory was really entitled to sell it. Domain spoofing worked exactly like that: a fraudster offered impressions labelled as a well-known publisher, a buyer paid the premium those impressions command, and the money went somewhere else entirely. The IAB Tech Lab's answer was to move the answer to a place the buyer already trusts — a text file on the publisher's own domain, reachable over HTTPS at a fixed path.

So the file is not an SEO artefact and it does not affect your rankings. It is an allowlist. A buyer reads it, compares the seller offering the impression against the accounts you declared, and drops the bid if there is no match.

What to check after you publish

Fetch the URL yourself before assuming it works. The three failures that account for most broken files are a redirect, a wrong content type, and a copy of the file that lives on www while the canonical host is bare, or the other way around. If both hosts serve pages, both need the file, and that is also true of every subdomain that carries ads — unless you list them with SUBDOMAIN=, which points the crawler at the child's own file rather than sharing yours.

Keep the file short and keep it honest. A common habit is pasting a partner's whole published list because it is easier than asking which line is yours; the result authorises dozens of sellers who have nothing to do with your inventory, which is precisely the situation the file was invented to prevent. When a partnership ends, remove the line — a stale RESELLER entry is a standing permission you are no longer supervising.

Related files at the root of your domain

Three unrelated text files live at the root of a domain and get confused with each other. robots.txt tells crawlers what to fetch. Your XML sitemap tells them what exists. This one tells advertising buyers who may sell your inventory, and no search engine reads it. If you are also setting up the domain's mail, the SPF record is the equivalent allowlist for sending servers.

Frequently asked questions

Where exactly does the file go?

At the root of the host that serves the pages carrying the ads: https://example.com/ads.txt. It has to answer with status 200 and a plain-text content type. A file under /assets/, a 301 to another domain or a CMS returning HTML for that path all count as no file at all.

What happens in AdSense if I never publish one?

AdSense shows an "Earnings at risk" warning in the account and keeps it there until the crawler finds a valid file with your publisher line in it. Buyers that filter on unauthorised inventory stop bidding on your impressions, so what you lose first is competition in the auction rather than serving itself.

Do I need app-ads.txt as well?

Only if you sell inventory inside a mobile or CTV app. It is the same syntax at the root of the developer website listed in the store entry, and it is a separate file — an app store listing points at your site, and the crawler looks for app-ads.txt there, not at ads.txt.

Is DIRECT or RESELLER the right word for my line?

DIRECT means you hold the account with that ad system yourself and are paid by them. RESELLER means the account belongs to somebody you authorised to sell on your behalf, typically a network or an ad management partner. When a partner sends you a line to paste, use exactly what they sent — guessing between the two is what makes a line worthless.

How long does a change take to have an effect?

Crawls are on the order of a day, sometimes longer for smaller buyers. Never delete a line the same day you add its replacement — remove the seller you dropped only after the new one has been picked up, or you spend a week with inventory nobody is authorised to sell.

Related tools

Updated