Skip to main content
Utilavo
Ab64

Base64 Encoder

Encode and decode Base64 strings and files for APIs, emails, and data URIs

How to use Base64 Encoder

  1. Choose encode or decode

    Select the mode: Encode converts text or file data to Base64. Decode converts Base64 back to text or a downloadable file.

  2. Enter your input

    Type or paste text into the input field, or upload a file for binary encoding.

  3. Copy the output

    The result appears instantly. Click Copy to copy it to your clipboard.

Mode

Input

What is Base64 encoding?

Base64 Encoder converts text or binary data to and from Base64 encoding. Base64 is widely used for embedding binary data in text formats such as HTML, CSS, JSON, and email — for example, encoding images as data URIs or transmitting binary data through APIs that only accept text.

You can encode plain text strings, or upload a file to encode its binary content directly. The reverse (decode) operation converts Base64 back to the original text or file. All processing is done locally in your browser.

Base64 encoding is essential in several common development scenarios. Front-end developers use it to embed small images directly in CSS or HTML as data URIs (data:image/png;base64,...), eliminating an HTTP request for each image and improving page load performance for icons and small graphics. API developers encode binary payloads — file uploads, image attachments, cryptographic tokens — into Base64 strings for JSON or XML request bodies that only support text. Email systems use Base64 to encode attachments and non-ASCII characters in MIME messages. DevOps engineers encounter Base64 when working with Kubernetes secrets, AWS IAM policies, and JWT tokens, all of which use Base64-encoded payloads.

The encoding process converts every 3 bytes of input into 4 ASCII characters from the alphabet A-Z, a-z, 0-9, +, and / (with = padding). This means Base64 output is always approximately 33% larger than the original binary data. For this reason, Base64 is best suited for small to medium payloads — embedding a 50 KB icon is practical, but encoding a 10 MB video would add over 3 MB of overhead. The URL-safe variant replaces + with - and / with _ to avoid conflicts with URL-reserved characters, which is important when Base64 strings appear in query parameters, filenames, or JWT tokens. Encoding and decoding both run in your browser using the native atob/btoa functions; see our processing model for full details.

Frequently asked questions

What is Base64 used for?

Base64 is used to represent binary data (like images or files) as a string of ASCII characters, so it can be safely embedded in text-based formats like HTML, JSON, XML, or email bodies that cannot handle raw binary.

Can I encode a file to Base64?

Yes. Click the file upload option, select your file, and the tool will encode the entire file contents to Base64. This is useful for creating data URIs or encoding attachments.

What is the URL-safe Base64 variant?

Standard Base64 uses + and / characters that have special meaning in URLs. URL-safe Base64 replaces these with - and _ so the encoded string can be used in URLs and filenames without percent-encoding.

How do I create a data URI from an image?

Upload your image file using the file encode option. The tool outputs the Base64 string. Prepend the appropriate MIME type prefix to create a complete data URI: data:image/png;base64, followed by the encoded string. Paste the full data URI into your CSS background-image property or an HTML img src attribute. This works best for small images (under 10 KB) like icons and decorative elements.

How do I decode a JWT token?

A JWT (JSON Web Token) has three Base64URL-encoded sections separated by dots: header.payload.signature. Copy the middle section (payload), paste it into the decode input, and the tool will output the JSON claims. Note that JWT uses URL-safe Base64, so the tool handles both standard and URL-safe variants. The decoded payload reveals the token's claims, expiration time, and other metadata.

Related tools

Related guides