HTTP 401

HTTP 401 Unauthorized — Meaning, Causes & How to Fix

Authentication is required and has failed or not been provided.

Code
401
Name
Unauthorized
Class
4xx Client Error
Specification
RFC 9110 §15.5.2
Cacheable by default
Only with explicit Cache-Control / Expires

What HTTP 401 means

401 Unauthorized really means unauthenticated: the request lacks valid credentials. The server must include a WWW-Authenticate header saying how to authenticate. Sending the right credentials could make the same request succeed.

Common causes

How to fix it

For site owners

For visitors & developers

SEO impact

Content behind a 401 cannot be crawled or indexed. Do not put pages you want ranked behind authentication; staging sites protected by 401 stay out of search results, which is usually the intent.

Example 401 response

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api", error="invalid_token"
Content-Type: application/json

{"error":"token_expired"}

Related status codes

403 · Forbidden400 · Bad Request404 · Not Found402 · Payment Required405 · Method Not Allowed406 · Not Acceptable408 · Request Timeout409 · Conflict

Check or look up another code

Search and filter every code in the HTTP Status Codes tool, browse the full list by class, or read HTTP status codes explained: the complete developer guide.

Open HTTP Status Codes tool →All status codes

Frequently asked questions

What does HTTP 401 mean?

HTTP 401 Unauthorized is a 4xx Client Error status code. Authentication is required and has failed or not been provided.

What is the difference between 401 and 403?

401 means “we don’t know who you are — authenticate”. 403 means “we know who you are (or it doesn’t matter) and you are not allowed”. Logging in can fix a 401, not a 403.

Which specification defines 401?

It is defined in RFC 9110 §15.5.2.

Is a 401 response cacheable?

Not by default. A 401 response is only stored by caches when it carries explicit freshness information such as Cache-Control: max-age or Expires.

More PAYATE tools