Basic Authentication Header Generator
The form below encodes credentials to base 64. Enter your user ID and password, using the format
username:password. Your encoded credentials will appear underneath.
The encoding script runs in your browser, and none of your credentials are seen or stored by this site.
- What is Basic Authentication?
- How to Use Basic Auth Credentials?
- Alternative Encoding Methods
What is Basic Authentication?
- Key = 'Authorization'
- Value = 'Basic '+ base 64 encoding of a user ID and password separated by a colon
How to Use Basic Auth Credentials?
Most API clients, as well as command line options like Curl, have a Basic Auth input option that will encode credentials for you.
However, if your tool doesn't have this option, or you'd prefer not to directly enter your username and password, Basic Auth credentials can be entered into the Headers section of any no-code API client like this:
Alternative Encoding Methods
#1 Chrome Developer Tools
You can encode your credentials yourself by opening Developer Tools in your browser (F12 on Windows/Linux or option + ⌘ + J on OSX). In the console, type in the following and click enter:
encodedData = "Basic " + window.btoa('YOUR_USERNAME:YOUR_PASSWORD')
You'll need to substitute in your own user credentials for YOUR_USERNAME and YOUR_PASSWORD, like this:
Copy this value (without the quotation marks)
#2 Curl Import Tools
Curl is an open-source, command line tool for sending data. Many API clients include an option to import Curl code snippets, e.g:
These Curl import tools will automatically encode your credentials to base64 during the import process.
#3 Automatic URL-based encoding
Most API clients will automatically apply basic authentication if you enter your credentials as
https://username:[email protected]. For example, this API request URL would automatically encode your credentials in a call to Shopify:
When you enable automatic basic authentication, you do not need to encode your credentials manually and shouldn't enter an Authorization header key/value pair. (In API Connector, if you enter a basic access Authorization header while also using automatic basic authentication, the Authorization header will take precedence).