CalculatorsConvertersDeveloperTextAll toolsDirectory
Submit your tool Sign in
Theme
Home/Answers/Security
How-to

How do I Base64-encode credentials for a Basic Auth header?

Short answer

Join the username and password with a colon as user:pass, then Base64-encode that string with a browser-based encoder to build the value for an HTTP Basic Auth header. The encoding runs on your device, so the credentials are never uploaded.

How Basic Auth is built

HTTP Basic Auth sends the header Authorization: Basic followed by the Base64 encoding of username:password. Base64 here is only a transport encoding, not encryption, so it is trivially reversible and must always travel over HTTPS. To construct the header value you Base64-encode the exact user:pass string, colon included.

Encode credentials without pasting them into a random site

Because a username and password are sensitive, you do not want to paste them into a server-side encoder. A client-side Base64 tool encodes the string in your browser, UTF-8 safe, so the credentials never leave your machine. You can also decode a value to check it. It is free and needs no account.

Step by step

  1. Build the credential string. Write your credentials as username:password with a colon between them.
  2. Open the encoder. Open the Base64 encoder in your browser and paste that string.
  3. Use the result. Copy the Base64 output and use it after Basic in the Authorization header.

Frequently asked questions

Is Base64 the same as encryption?

No. Base64 is a reversible encoding, so Basic Auth must always be sent over HTTPS.

What exactly do I encode?

You encode the username and password joined by a colon, as user:pass.

Are my credentials uploaded?

No. The encoding runs in your browser, so nothing is sent to a server.

Related answers