Mastodon user agent
Operated by Mastodon
Mastodon is the user agent Mastodon servers send when they fetch link previews for posts.
The Mastodon bot at a glance
- Mastodon is operated by Mastodon and reads page titles, descriptions and images to build link previews.
- The robots.txt token for Mastodon is Mastodon.
- Blocking a social preview bot has no effect on search rankings.
- Mastodon robots.txt support: Not documented.
- Recommendation for Generative Engine Optimization (GEO): Allow.
What is Mastodon?
Each Mastodon server fetches a preview itself, so one popular post can trigger requests from many servers at once.
The user agent includes the requesting server’s address after “Mastodon/”.
Should you block Mastodon?
Allow Mastodon unless it causes a measurable load problem.
| Effect on search rankings | Blocking a social preview bot has no effect on search rankings. |
|---|---|
| Effect on AI visibility | No direct effect on AI answers, but shared links lose their title, image and description, which usually lowers clicks from social and chat apps. |
| Follows robots.txt | Not documented |
| Recommendation | Allow |
How to block or allow Mastodon
Put the robots.txt rule in the file at the root of every domain and subdomain, for example https://example.com/robots.txt. The token Mastodon is matched case-insensitively. robots.txt alone may not stop Mastodon, so add the Nginx, Apache or Cloudflare rule as well.
robots.txt: block
# Block Mastodon
User-agent: Mastodon
Disallow: /robots.txt: allow
# Allow Mastodon
User-agent: Mastodon
Allow: /robots.txt: partial
# Keep Mastodon out of private areas only
User-agent: Mastodon
Disallow: /wp-admin/
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
Allow: /Nginx
# Nginx: return 403 to Mastodon
if ($http_user_agent ~* "(Mastodon)") {
return 403;
}Apache
# Apache .htaccess: return 403 to Mastodon
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (Mastodon) [NC]
RewriteRule .* - [F,L]Cloudflare WAF
# Cloudflare > Security > WAF > Custom rule, action: Block
(http.user_agent contains "Mastodon")How to verify real Mastodon traffic
Mastodon publishes no IP list or reverse DNS pattern for Mastodon, so the user agent cannot be verified. Anyone can send the same string. Rate-limit unusual volume instead of trusting the name.
How to find Mastodon in your server logs
Search the web server access log for the token. The command below counts Mastodon requests per URL on Nginx or Apache.
grep -i "Mastodon" access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20For a full report per AI bot, upload the log to the AI Log File Analyzer, a free tool by Justin Hà.
Mastodon user agent string
The full user agent Mastodon publishes for Mastodon. Version numbers such as Chrome/W.X.Y.Z change over time, so match the token, not the whole string.
http.rb/2.2.2 (Mastodon/1.5.1; +https://example-masto-instance.org/)Mastodon FAQ
Mastodon identifies itself with the robots.txt token "Mastodon". A typical request header reads: http.rb/2.2.2 (Mastodon/1.5.1; +https://example-masto-instance.org/)
Mastodon has not documented how Mastodon treats robots.txt. Add a robots.txt rule and back it with a server rule if the traffic matters to you.
Blocking a social preview bot has no effect on search rankings. No direct effect on AI answers, but shared links lose their title, image and description, which usually lowers clicks from social and chat apps.
Add two lines to the robots.txt file at the root of each domain and subdomain: "User-agent: Mastodon" followed by "Disallow: /". The token is case-insensitive. Changes can take up to 24 hours to be picked up.
Not reliably. Mastodon publishes no IP list or reverse DNS pattern for Mastodon, so anyone can send the same user agent. Rate-limit unusual volume instead of trusting the name.
Search your server access log for "Mastodon", for example with: grep -i "Mastodon" access.log. The AI Log File Analyzer by Justin Hà counts visits per AI bot from an uploaded log file.
Sources: Public bot registry. Last reviewed by Justin Hà.
See which of these bots actually reach your website
The AI Log File Analyzer by Justin Hà counts visits from GPTBot, ClaudeBot, PerplexityBot and other AI crawlers in your server log, for free. The GEO Technical Package sets up robots.txt, llms.txt and crawler access for AI search.