Free Online Tool

Base64 Encode / Decode

Encode text to Base64 or decode Base64 strings instantly

All processing happens in your browser — no data is sent to any server

Plain Text

Text to encode

Input

Base64 Output

Encoded result

Output

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It was designed to safely transmit binary data through channels that only support text, such as email (MIME), URLs, and HTTP headers.

Base64 works by taking groups of 3 bytes (24 bits) and splitting them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input isn't divisible by 3, the output is padded with = characters. This means Base64 encoding increases the data size by approximately 33%.

Common Uses for Base64

HTTP Basic Authentication

The HTTP Basic auth scheme encodes username:password in Base64 and sends it in the Authorization header. This is encoding, not encryption — Base64 is trivially reversible and provides no security on its own. Always use HTTPS.

JWT Token Payloads

JSON Web Tokens (JWTs) encode their header and payload sections as Base64url (a URL-safe variant). Decoding the payload reveals claims like user ID, roles, and expiration time without needing the secret key.

Data URIs in HTML/CSS

Small images, fonts, or other assets can be embedded directly in HTML or CSS asdata:image/png;base64,... URIs. This eliminates extra HTTP requests at the cost of larger HTML size.

Email Attachments (MIME)

Email protocols (SMTP) only support 7-bit ASCII text. Binary attachments (images, PDFs, documents) are Base64-encoded for safe transmission and decoded by the receiving email client.

Base64 vs Base64url

Standard Base64 uses + and / characters, which have special meanings in URLs. Base64url (RFC 4648 §5) replaces them with - and_, and typically omits the = padding. This variant is used in JWTs, URL parameters, and filename-safe contexts.

VariantAlphabetPaddingCommon Use
Base64A-Z, a-z, 0-9, +, /= paddingEmail (MIME), data URIs, PEM certificates
Base64urlA-Z, a-z, 0-9, -, _No paddingJWTs, URL parameters, filenames

Important: Base64 Is Not Encryption

Base64 is an encoding scheme, not an encryption or hashing algorithm. Anyone can decode Base64 instantly — it provides zero confidentiality. Never use Base64 to “hide” passwords, tokens, or sensitive data. If you need to protect data, use proper encryption (AES, RSA) or hashing (bcrypt, Argon2).

Related Tools

How to Use the Base64 Encoder / Decoder

1

Choose Encode or Decode

Select the "Encode" tab to convert plain text to Base64, or the "Decode" tab to convert Base64 back to plain text.

2

Paste or type your input

Enter the text you want to encode or the Base64 string you want to decode into the input textarea on the left.

3

Click the button

Press "Encode to Base64" or "Decode from Base64". The result instantly appears in the output panel.

4

Copy the result

Use the "Copy" button to copy the output to your clipboard and paste it wherever you need it.

Frequently Asked Questions

Is Base64 encoding the same as encryption?

No. Base64 is an encoding scheme, not encryption. Anyone can decode Base64 instantly — it provides no confidentiality. Never use Base64 to hide passwords or sensitive data. For encryption, use AES or RSA. For password storage, use bcrypt or Argon2.

Why does my Base64 output end with "=" or "=="?

Base64 works in groups of 3 bytes. When the input length isn't divisible by 3, padding characters (=) are added to make the output a multiple of 4 characters. One "=" means one byte of padding; "==" means two bytes.

What is Base64url and how is it different?

Base64url (RFC 4648 §5) replaces "+" with "-" and "/" with "_", and usually omits padding. This makes it safe to use in URLs and filenames. JWTs use Base64url for their header and payload sections.

Can I use this to encode images or binary files?

This tool encodes and decodes text (UTF-8). For encoding binary files like images as Base64 data URIs, you need a tool that handles binary input. The output of encoding a text representation of binary data may not be what you expect.

Is my data sent to a server when I use this tool?

No. All encoding and decoding happens entirely in your browser using JavaScript. Your data never leaves your device and is not stored or logged anywhere.

How much does Base64 increase file size?

Base64 encoding increases data size by approximately 33%. Every 3 bytes of input produce 4 characters of output. A 100 KB file becomes approximately 133 KB when Base64-encoded.

Learn More

Read our developer guides to go deeper on encoding, data formats, and conversion tools.

Built by JDApplications