How to Create an ads.txt File Step by Step
A plain-English walkthrough for creating your ads.txt file from scratch. Get the format right, find your account IDs, and validate every line before going live.

Key Takeaways
- An ads.txt file is a plain text file at your root domain that lists every company authorized to sell your ad inventory. DSPs crawl this file to verify that bid requests come from legitimate sellers.
- Each line follows a strict four-field format: exchange domain, account ID, relationship type (DIRECT or RESELLER), and an optional TAG-ID. Get the order wrong and DSPs skip the line entirely.
- The most critical step is getting the right account IDs. These must match what the SSP has on file. A single digit off means verification failure and blocked bids.
- You don't need technical skills to create ads.txt. A plain text editor and FTP access (or a CMS plugin) are all it takes. The entire process takes 15-30 minutes for most publishers.
- Validation isn't optional. After uploading, verify that DSPs can fetch the file at
yourdomain.com/ads.txtwith a 200 status code andtext/plaincontent type.
---
How to Create an ads.txt File Step by Step
If you monetize through programmatic advertising, you need an ads.txt file.
Without one, DSPs treat your inventory as unverified. Some refuse to bid entirely. Others bid at reduced rates because they can't confirm that the SSP sending the bid request is actually authorized to sell your traffic.
Revenue gone.
Just like that.
The IAB Tech Lab introduced ads.txt in 2017 to combat domain spoofing, where fraudsters forge bid requests pretending to be a legitimate publisher. The fix was simple: publishers post a public list of authorized sellers at their root domain. DSPs check the list. If the seller isn't on it, the bid gets rejected.
Creating the file is straightforward. Getting every line right is where publishers trip up.
This guide walks through each step, from collecting account IDs to validating the finished file.
Step 1: Collect Your SSP Account Information
Before writing a single line, you need the correct details from every SSP, ad network, and monetization partner you work with.
For each one, collect:
- Exchange domain. The domain that appears in bid requests. This isn't always the SSP's main website. For example, Google uses
google.com, notadsense.google.com. AppNexus usesappnexus.com. - Account ID. The publisher or seat ID assigned to your account on that exchange. This is the most common source of errors. It must match exactly what the SSP has in their system. Exactly.
- Relationship type. DIRECT or RESELLER. If the SSP pays you directly, it's DIRECT. If payment goes through an intermediary (ad network, monetization partner), it's RESELLER.
- TAG-ID (optional but recommended). The SSP's Trustworthy Accountability Group certification ID. This adds another verification layer. Most SSPs provide this in their documentation.
Where to find these details:
| SSP/Partner | Where to Find Account ID |
|------------|------------------------|
| Google AdSense | AdSense dashboard > Account > Account information > Publisher ID (pub-XXXXXXXXXXXXXXXX) |
| Google Ad Manager | Admin > Global Settings > Network code |
| PubMatic | Publisher dashboard > Account Settings |
| Index Exchange | Account Settings > Publisher ID |
| OpenX | Publisher portal > Account section |
| Magnite (Rubicon) | Dashboard > Account Settings |
| Other partners | Publisher portal or ask your account manager directly |
Most major SSPs also provide a pre-formatted ads.txt line that you can copy directly from your dashboard. Use that whenever available. It eliminates the chance of typos, and trust us, typos are the number one issue we see.
Step 2: Open a Plain Text Editor
This is critical.
Use a plain text editor, not a word processor.
Use: Notepad (Windows), TextEdit in plain text mode (Mac), VS Code, Sublime Text, or any code editor.
Do not use: Microsoft Word, Google Docs, Apple Pages, or any rich text editor. These programs insert invisible formatting characters, curly quotes, and encoding artifacts that break ads.txt parsing.
A line that looks correct in Word might contain hidden characters that make it completely unparseable to DSPs.
You can't see the problem. But the DSP can.
If you must draft in Google Docs for collaboration, always paste the final version into a plain text editor before saving. Check for curly quotes (" vs "), em dashes, and non-standard whitespace.
Step 3: Write Your Entries
Each line in ads.txt follows this exact format:
text<exchange-domain>, <account-id>, <relationship-type>, <tag-id>
Here's a real example with multiple entries:
textgoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0 pubmatic.com, 156423, DIRECT, 5d62403b186f2ace appnexus.com, 3703, RESELLER, f5ab79cb980f11d1 openx.com, 537149485, RESELLER, 6a698e2ec38604c6 rubiconproject.com, 18020, DIRECT, 0bfd66d529a55807
Format rules:
- Comma-separated. Each field separated by a comma and a space. Some parsers tolerate extra spaces, but clean formatting prevents issues.
- One entry per line. Each authorized seller gets its own line.
- DIRECT and RESELLER must be uppercase. Lowercase
directorresellercan cause parsing failures on strict DSP crawlers. Don't risk it. - TAG-ID is optional. If you don't have it, just use three fields:
google.com, pub-1234567890123456, DIRECT - Comments start with #. Use comments to organize your file by partner type.
- No trailing commas, no extra fields. Stick to the spec exactly.
A well-organized file with comments looks like this:
text# Direct SSP relationships google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0 rubiconproject.com, 18020, DIRECT, 0bfd66d529a55807 pubmatic.com, 156423, DIRECT, 5d62403b186f2ace # Header bidding partners (resellers) appnexus.com, 3703, RESELLER, f5ab79cb980f11d1 openx.com, 537149485, RESELLER, 6a698e2ec38604c6 sovrn.com, 257611, RESELLER, fafdf38b16bf6b2b
Comments make your file easier to maintain. Six months from now, you'll want to know why each line is there.
Trust me on this one.
Step 4: Save the File Correctly
Save the file with the exact filename ads.txt. Not Ads.txt, not ads.txt.txt, not ads-txt.txt.
The filename is case-sensitive on most servers.
Ensure the encoding is UTF-8 without BOM (byte order mark). Most plain text editors default to this, but verify in your editor's save settings if you're unsure. A BOM character at the start of the file can cause parsing issues with some DSP crawlers.
Step 5: Upload to Your Root Domain
The file must be accessible at:
texthttps://yourdomain.com/ads.txt
Not https://yourdomain.com/advertising/ads.txt. Not https://blog.yourdomain.com/ads.txt (unless that subdomain runs its own inventory).
The root domain, at the root path. That's the only place DSPs look.
Upload methods:
FTP/SFTP Upload
Connect to your server via FTP and upload ads.txt to the same directory as your index.html or index.php. This is usually /public_html/, /var/www/html/, or /htdocs/.
WordPress
Install the Ads.txt Manager plugin from the WordPress plugin directory. Go to Settings > Ads.txt, paste your entries, and save. The plugin creates and serves the file automatically.
No FTP needed.
Or if you prefer not to use a plugin, upload the file via FTP to your WordPress root directory (the same folder that contains wp-config.php).
Shopify
Go to Settings > Online Store > Preferences and scroll to the ads.txt section. Paste your entries there. Shopify serves the file at your root domain automatically.
Wix
Wix provides a built-in ads.txt editor under Marketing Integrations. Paste your lines and publish.
Static Site Generators (Next.js, Gatsby, Hugo)
Place the ads.txt file in your public/ or static/ directory. It gets copied to the build output root during deployment.
CDN-Hosted Sites (Cloudflare, AWS CloudFront)
If your site is behind a CDN, make sure the ads.txt file isn't cached with overly aggressive TTLs. DSPs need to see updates within 24-48 hours. Set cache headers to a few hours at most for this file.
Step 6: Validate the File
After uploading, run through this validation checklist:
1. Check HTTP accessibility.
Open https://yourdomain.com/ads.txt in your browser. You should see your raw text entries. If you get a 404, the file isn't at the right path. If you see HTML instead of plain text, your server is wrapping the response.
2. Verify HTTP status code and content type.
The response must return HTTP 200 with Content-Type: text/plain. Some servers return text/html for all files by default. If yours does, add a server rule to set the correct content type for ads.txt.
3. Check for redirect chains.
If http://yourdomain.com/ads.txt redirects to https://yourdomain.com/ads.txt, that's fine (one redirect). But if DSP crawlers hit 5+ redirects, many will give up. Keep redirects minimal.
4. Verify robots.txt isn't blocking access.
Check your robots.txt file. If you have a Disallow: / rule for certain bots, it might block DSP crawlers from reaching your ads.txt. Make sure /ads.txt is explicitly allowed or not blocked.
5. Use an automated validator.
The IAB Tech Lab provides validation guidelines. BeamFlow's scanner validates syntax, checks every account ID against the SSP's sellers.json, and flags mismatches automatically.
6. Cross-verify against sellers.json.
This is the step most publishers skip. And it's the one that matters most.
Your ads.txt lines need to match what each SSP reports in their sellers.json file. If your account ID or relationship type doesn't match, DSPs running supply path optimization will reject the bid.
24% of ads.txt entries fail this cross-verification. A quarter.
Step 7: Verify Changes Propagate
After uploading, DSPs won't pick up the changes immediately. Most major DSPs re-crawl ads.txt files every 24-72 hours.
Google's crawlers typically check within 24 hours. Smaller DSPs may take longer.
Wait 48-72 hours after your initial upload before expecting full verification from all buyers. If you're launching a new site with a new ads.txt, give it a full week before evaluating bid rates.
You can test whether the file is crawler-accessible by fetching it from outside your network. Use a different device, a VPN, or a command-line tool like curl:
textcurl -I https://yourdomain.com/ads.txt
The response should show HTTP/2 200 and content-type: text/plain.
Common Mistakes to Avoid During Setup
Copying another publisher's ads.txt. Each publisher has unique account IDs. Copying from a competitor means every line fails verification because the IDs belong to them, not you.
We see this more often than you'd think.
Using your SSP dashboard URL as the domain. The domain field is the exchange domain in bid requests (e.g., google.com), not the management portal URL (e.g., admanager.google.com).
Forgetting reseller entries. If you use a header bidding wrapper or monetization partner that holds SSP accounts on your behalf, their lines need to be listed as RESELLER. Missing them means those bid paths are unauthorized.
Not updating after partner changes. Every time you add or remove an SSP relationship, update your ads.txt the same day. Make it part of the same operational ticket as the ad server configuration change.
One doesn't ship without the other.
Frequently Asked Questions
How long does it take to create an ads.txt file?
For a publisher with 5-10 SSP relationships, the process takes 15-30 minutes. Most of that time goes to logging into each SSP dashboard and finding the correct account IDs. The actual file creation is a few minutes of typing.
Do I need a separate ads.txt for each subdomain?
Only if the subdomain runs its own ad inventory independently. If blog.yourdomain.com has its own ad stack, it needs its own ads.txt at blog.yourdomain.com/ads.txt. If all subdomains share the same ad setup as the root domain, only the root domain file is needed.
What if my SSP doesn't provide a TAG-ID?
Leave the fourth field blank. A three-field line (google.com, pub-123, DIRECT) is valid per the IAB spec. The TAG-ID adds extra verification but isn't required. That said, most major SSPs have TAG-IDs. If yours doesn't provide one, check their documentation again or ask your account representative.
Can I have comments in my ads.txt file?
Yes. Lines starting with # are treated as comments and ignored by parsers. Use them to label sections, note when entries were added, or document which monetization partner owns a RESELLER line.
Future you will be grateful.
What happens if I make an error in my ads.txt?
The specific line with the error gets ignored by DSPs. It doesn't invalidate the entire file. But that one broken line means the corresponding SSP path is unauthorized, and bids through it will be rejected.
Fix errors as soon as you discover them.
Related Articles

ads.txt Checklist Before Going Live With a New SSP
Adding a new SSP? Use this checklist to get ads.txt right from day one. Most verification issues happen during onboarding because publishers skip steps they do not know about.

How to Track ads.txt Issues Across Multiple Domains
Managing ads.txt for one domain is straightforward. Managing it across five, ten, or fifty domains is where things break. Here is how to keep every domain verified.

How to Monitor ads.txt Changes Over Time
SSPs change sellers.json without telling you. Your own team edits ads.txt without documenting it. Monitoring changes over time catches issues before they cost revenue.
Ready to optimize your ads.txt?
Check your domain's supply chain health instantly, free.
Check Your Domain Free