Basic Auth Encoder / Decoder

Build an HTTP Basic Authentication header from a username and password, or decode an existing token to extract credentials — with a live step-by-step breakdown.

Credentials
Step-by-step breakdown
1 Combined username:password
↓ btoa()
2 Base64 dXNlcm5hbWU6cGFzc3dvcmQ=
↓ prepend Basic 
3 Header Authorization: Basic …

What Is HTTP Basic Authentication?

HTTP Basic Authentication is the simplest standardized access-control mechanism for web APIs and services, defined in RFC 7617. It works by combining a username and password into a single string, encoding it with Base64, and sending it in the Authorization HTTP request header on every call. Because the scheme is stateless, no sessions or cookies are required — the server validates credentials on each request independently.

Basic Auth is natively supported by browsers, curl, Postman, HTTPie, and virtually every HTTP client and server framework. Its simplicity is its main asset — but also its main limitation: since Base64 is an encoding scheme and not encryption, Basic Auth credentials are trivially reversible. Always use HTTPS (TLS) when transmitting Basic Auth headers to prevent credentials from being captured in transit.

How to Build a Basic Auth Header — Step by Step

Constructing an Authorization: Basic header is a three-step process:

  1. Combine credentials with a colon — concatenate the username and password separated by :, for example admin:secret123. The username must not itself contain a colon; the password may.
  2. Base64-encode the combined string — apply standard Base64 encoding (RFC 4648) to produce the token, e.g. YWRtaW46c2VjcmV0MTIz.
  3. Prepend the scheme and set the header — prefix with Basic (note the trailing space) and send the full header: Authorization: Basic YWRtaW46c2VjcmV0MTIz.

The tool above performs all three steps live as you type, displaying every intermediate value in a monospace panel so you can understand exactly what the server receives — and copy any step individually.

When to Use Basic Auth

Basic Auth is the right tool in several concrete scenarios:

  • CI/CD pipelines — authenticating automated scripts to package registries (npm, Maven, Docker Hub), artifact stores, or deployment APIs without storing session state.
  • Internal service-to-service calls — microservices on a private network communicating over HTTPS where a lightweight credential mechanism is preferred over OAuth token exchange overhead.
  • Package manager configuration — npm, pip, Maven, and Gradle all support Basic Auth credentials in their registry configuration files (.npmrc, pip.conf, settings.xml).
  • Quick staging protection — locking a development or preview environment with a single shared password without deploying an identity provider.
  • curl and scripting — the -u username:password flag in curl builds and sends the Basic Auth header automatically.

For user-facing authentication — login forms, mobile apps, public APIs — prefer OAuth 2.0, API tokens with expiry, or session cookies with CSRF protection. These schemes allow credential rotation, scoped access, and revocation without changing a hard-coded password everywhere it is used.

Decoding a Basic Auth Token

Because Base64 provides no confidentiality, any Basic Auth token can be decoded instantly by anyone who captures it. This makes the Decode tab practically useful in several situations: inspecting HTTP traffic in browser Tools Searcher, reviewing historical API logs, auditing credentials in configuration files, or debugging authentication failures where you want to confirm the exact username and password the client is sending.

Paste the raw Base64 token, the Basic <token> string, or the entire Authorization: Basic <token> header line — the decoder strips any prefix automatically and always splits on the first colon, correctly preserving colons inside the password.

Basic Auth in Common HTTP Clients

Every major HTTP client has native Basic Auth support:

  • curl: curl -u admin:secret https://api.example.com/data
  • JavaScript (fetch): 'Authorization': 'Basic ' + btoa('admin:secret')
  • Python (requests): requests.get(url, auth=('admin', 'secret'))
  • Go (net/http): req.SetBasicAuth("admin", "secret")
  • HTTPie: http -a admin:secret GET https://api.example.com/data
  • Postman: Authorization tab → Type: Basic Auth → fill Username and Password fields

Examples

Standard API credentials

Username: admin · Password: secret123

Combined: admin:secret123

Base64: YWRtaW46c2VjcmV0MTIz

Header: Authorization: Basic YWRtaW46c2VjcmV0MTIz

API key as password (empty username)

Some services use an empty username with an API key as the password:

Combined: :ghp_myGitHubToken

Base64: OmdocF9teUdpdEh1YlRva2Vu

Header: Authorization: Basic OmdocF9teUdpdEh1YlRva2Vu

Password containing a colon

Username: user · Password: p:a:s:s

Combined: user:p:a:s:s

Split rule: first colon only — password is preserved as p:a:s:s

Base64: dXNlcjpwOmE6czpz

curl with Basic Auth

curl automatically encodes credentials passed with -u:

curl -u admin:secret123 \
  https://api.example.com/v1/users

This is equivalent to setting Authorization: Basic YWRtaW46c2VjcmV0MTIz manually.

Frequently Asked Questions