PublicSoftTools

Base64 Encoder

Encode text to Base64 format instantly. Perfect for embedding credentials in HTTP headers, generating data URIs, and building JSON payloads that contain binary content.

Base64 Encoder

How Base64 Encoding Works

  1. 1Type or paste the text you want to encode. The encoder converts it to UTF-8 bytes first, then processes the bytes.
  2. 2The encoder groups bytes into sets of 3 (24 bits) and maps each 6-bit chunk to one of the 64 Base64 characters. Padding = characters are added if needed.
  3. 3The encoded string appears instantly. Click Copy to paste it into your code, config file, or HTTP header.

HTTP Basic Authentication and Base64

One of the most common developer uses of Base64 encoding is building HTTP Basic Auth headers. The Authorization header value is constructed as Basic <base64(username:password)>. For example, to authenticate as user alice with password secret, encode the string alice:secret to get YWxpY2U6c2VjcmV0, then send the header Authorization: Basic YWxpY2U6c2VjcmV0. Note that Basic Auth provides no security on its own — always use it over HTTPS.

Common Uses for Base64 Encoding

HTTP Basic Auth Headers

Build the Authorization header for HTTP Basic Auth by encoding "username:password" to Base64 and prefixing it with "Basic ". Required when calling APIs that use Basic Auth.

Embedding Images in CSS

Small images and icons can be embedded directly in CSS or HTML as data URIs — url('data:image/png;base64,...') — eliminating a separate HTTP request.

JSON API Payloads

JSON is text-only, so binary file content (PDFs, images) must be Base64-encoded before embedding in a JSON request body. Many document APIs expect this format.

Kubernetes Secrets

Values in Kubernetes Secret manifests must be Base64-encoded. Encode your credentials, certificates, or API keys here before pasting them into a secret YAML file.

JWT Generation

JSON Web Token headers and payloads are Base64url-encoded JSON objects. Encode your header and payload JSON here as the first step in manually constructing or testing a JWT.

SMTP / Email Attachments

Email attachments in MIME format must be Base64-encoded. If you are constructing raw SMTP messages or testing email delivery, encode the file content here.

Frequently Asked Questions

What is Base64 encoding?

Base64 encoding converts binary data (or text bytes) into a string of 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. The name comes from the 64-character alphabet used. It is a standard way to represent binary content — images, files, credentials — as plain text so it can be safely embedded in text-based formats like JSON, HTML, XML, and email.

How much larger does Base64 make my data?

Base64 encoding increases the size of the data by approximately 33%. This is because every 3 bytes of input (24 bits) are represented by 4 Base64 characters (6 bits each). A 1,000-byte string becomes roughly 1,333 characters in Base64. Padding = characters may add 0–2 extra characters to make the output length a multiple of 4.

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. It is trivially reversible — anyone can decode a Base64 string back to its original content with no key or password. Do not use Base64 to protect sensitive data. It provides no security, confidentiality, or integrity guarantees. It is purely a format transformation for interoperability.

What is the = sign at the end of Base64 output?

Base64 works on 3-byte groups. If the input is not a multiple of 3 bytes, padding = characters are appended to make the output length a multiple of 4. One = means one byte of padding was needed; == means two bytes. The padding is required by the standard — some systems omit it ("unpadded Base64"), but most expect it.

What is Base64url and when should I use it?

Base64url is a variant of Base64 used in URLs and file names. It replaces + with - and / with _ to avoid conflicts with URL special characters. It is used in JWTs, PKCE OAuth flows, and other web standards. If you are generating a JWT or a URL-safe token, use the Base64url variant rather than standard Base64.

Can I encode non-English or Unicode text?

Yes. This tool encodes the UTF-8 byte representation of your input text. Unicode characters — including accented letters, Arabic, Chinese, Japanese, emoji, and other non-ASCII content — are first converted to their UTF-8 byte sequences, then those bytes are Base64-encoded. The decoder must also know to interpret the output as UTF-8 to recover the original text correctly.