503 Service Unavailable is the HTTP status code for a temporary outage or overload. Returning it during planned maintenance tells search engines not to treat the downtime as missing content. Google slows crawling when it sees 503s and retries later. If they continue for a long time, though, Google starts treating the URLs as unavailable and may drop them.
Using 503 for maintenance
Serve the maintenance page with a 503 status instead of a 200. Optionally add a Retry-After header giving the expected wait in seconds or as a date. Google has said it may use Retry-After as a hint, though it is not guaranteed to follow it exactly.
HTTP/1.1 503 Service Unavailable
Retry-After: 3600
Content-Type: text/html
<h1>Back soon</h1><p>We're doing scheduled maintenance.</p>Keep it short
503 is designed for short interruptions. Google's guidance treats it as suitable for brief pauses and warns that serving it for longer, more than a few days, can lead to URLs being dropped from the index. For longer pauses, keep the site up in a reduced state instead.
Watch robots.txt
If robots.txt returns a 503, Google may pause crawling of the whole site. During maintenance, consider serving robots.txt normally with a 200 while the pages return 503, unless you want crawling to stop entirely.
Example
A database migration window
Graphwick schedules a 90-minute database migration. Its CDN is configured to serve a static maintenance page with a 503 and Retry-After: 5400 for all HTML routes, while robots.txt and the sitemap keep returning 200. After the window, Crawl stats show a brief dip and then a return to normal.
Common mistakes
Serving maintenance pages with 200
Crawlers may index the maintenance message in place of real content.
Using 503 for long shutdowns
Extended 503s are eventually treated like a permanent problem. For long pauses, keep the site up in a reduced state.
Questions
Google treats 429 Too Many Requests like a server error for crawl-rate purposes: it slows down. Use 429 for rate limiting and 503 for outages.