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 exists because some channels only carry text. It re-expresses arbitrary bytes as printable ASCII so binary content can travel inside HTML, CSS, JSON, XML, or an email body without anything along the way mangling it.

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.

The uses cluster in a few recognisable places. Small images inline into CSS or HTML as data URIs (data:image/png;base64,...), trading a byte penalty for one fewer HTTP request. Binary payloads ride inside JSON and XML request bodies that have no other way to carry them. MIME encodes attachments and non-ASCII headers in email. Kubernetes secrets, AWS IAM policy documents, and all three segments of a JWT are Base64 at rest, which is why the encoding turns up constantly in operations work even when nobody chose it deliberately.

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