Free auditStart free
GuideError · HTTP status codes

HTTP 401 Unauthorized

A 401 means the request lacks valid credentials for the resource. Learn the WWW-Authenticate challenge, how it differs from 403, and how to fix it.

5 min
read
7
sources
Oct 22, 2026
updated
Scaplet Editorial Team
author
The short answer

HTTP 401 Unauthorized means the request has not been applied because it lacks valid authentication credentials for the target resource. The server must send a WWW-Authenticate header naming how to authenticate. Fix it by sending valid credentials in an Authorization header. If you already did, the server refused them. If you are signed in and still blocked, you are probably looking at a 403.

  1. What does 401 Unauthorized mean?
  2. The challenge and response flow
  3. How to fix a 401 as a user
  4. How to fix a 401 as a developer or site owner
  5. What it does to SEO
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02How it works

The challenge and response flow

A 401 response as MDN shows it
HTTP/1.1 401 Unauthorized
Date: Tue, 02 Jul 2024 12:18:47 GMT
WWW-Authenticate: Bearer

Common schemes in MDN's list include Basic (RFC 7617), Bearer (RFC 6750, bearer tokens for OAuth 2.0-protected resources) and Digest (RFC 7616). Basic sends credentials base64-encoded, not encrypted, so use it only over HTTPS.

  1. 01

    Request without credentials

    The client asks for a protected URL with no Authorization header.

  2. 02

    Server challenges

    It answers 401 with a WWW-Authenticate header, for example WWW-Authenticate: Bearer or WWW-Authenticate: Basic realm="Access to the staging site".

  3. 03

    Client retries with credentials

    The client repeats the request with an Authorization header, whose format depends on the scheme: Authorization: <type> <credentials>. Browsers usually show a password prompt first.

  4. 04

    Server decides

    Valid credentials get the resource. Invalid ones get another 401. Valid credentials without enough rights get a 403.

03Checklist

How to fix a 401 as a user

  1. 01Sign in, or sign in again. Expired or wrong credentials are the plainest cause.
  2. 02Check that you're using the account the resource belongs to. An account that is valid but not allowed would get a 403 instead.
  3. 03Don't repeat a request with the same wrong credentials; a client that already tried and gets the same challenge should show the response to you, since RFC 9110 says it usually carries relevant diagnostic information.
  4. 04If you don't have an account, ask the site owner. A 401 on a page with no login option usually means the page is meant to be private.
05Explained

What it does to SEO

Google lists 401 among the 4xx codes it handles alike (except 429): the content is treated as not existing, and an indexed URL is removed from the index. It also says 401 and 403 have no effect on crawl rate. Google doesn't index URLs that return a 4xx status code, so a login-gated page that returns 401 stays out of search, and a public page that returns 401 to Googlebot will drop out. See 4xx errors and Google's page on how HTTP status codes affect its crawlers.

Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01What is the difference between 401 and 403?

A 401 says the request lacks valid authentication credentials and must carry a WWW-Authenticate challenge, so new credentials can work. A 403 says the server understood the request and refuses it; MDN says authenticating or re-authenticating makes no difference.

02What is HTTP authentication?

A framework in which the server challenges a request with 401 and a WWW-Authenticate header, and the client answers with an Authorization header. MDN notes the exchange is the same for most schemes, though the header contents differ.

03Why do I keep getting a 401 error?

The server is not accepting the credentials sent. Check that the Authorization header is present, that its scheme matches the challenge, that the token hasn't expired, and that no proxy is stripping the header.

04What does error code 401 mean on a website?

The page needs you to sign in or the credentials you gave were rejected. If you are signed in and still blocked, expect a 403 instead, which signing in again won't fix.

Sources · 7

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • rfc-editor.org
  • mozilla.org
  • nginx.org
  • github.com
  • curl.se
  • google.com
  1. 01RFC 9110: HTTP Semanticsrfc-editor.org · checked 2026-10-25
  2. 02401 Unauthorized - HTTP - MDN Web Docsdeveloper.mozilla.org · checked 2026-10-25
  3. 03HTTP authentication - MDN Web Docsdeveloper.mozilla.org · checked 2026-10-25
  4. 04Module ngx_http_auth_basic_module - nginx documentationnginx.org · checked 2026-10-25
  5. 05nginx source: ngx_http_auth_basic_module.c (GitHub)github.com · checked 2026-10-25
  6. 06curl man pagecurl.se · checked 2026-10-25
  7. 07How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-10-25
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane