DevToolbox

Base64 Encoder & Decoder

Encode and decode Base64 text and files

Input
Type, paste, or drop a file
Loading...
Output

Output will appear here

Related tools

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used for embedding images in HTML/CSS, encoding email attachments, and transmitting data over text-based protocols. This tool encodes text or files and decodes Base64 entirely in your browser; nothing you enter is sent to a server unless you create a share link.

When to use Base64 encoding

Base64 is used whenever binary data must travel through a channel that only reliably handles text. Common cases include embedding images or fonts directly in HTML and CSS as data URIs, encoding email attachments (MIME), storing binary blobs inside JSON or XML, and passing binary values in URLs or HTTP headers.

Because Base64 represents every three bytes of input as four ASCII characters, the encoded output is roughly 33% larger than the original. That trade-off — size for text-safety — is why Base64 is used for transport and embedding rather than for storage or compression.

Base64 is encoding, not encryption

This is the most important thing to understand about Base64: it provides no security whatsoever. Anyone can decode a Base64 string back to its original value instantly, with no key. Never use Base64 to hide passwords, tokens, or secrets. If you need confidentiality use real encryption such as AES; if you need to detect tampering use an HMAC or a digital signature.

How Base64 works

Base64 processes input three bytes (24 bits) at a time and splits those 24 bits into four groups of six bits. Each 6-bit group is a number from 0 to 63, which maps to one character in the Base64 alphabet — which is why three bytes of input always become four characters of output.

When the input length is not a multiple of three, the final group is padded. One leftover byte produces two Base64 characters followed by '==', and two leftover bytes produce three characters followed by a single '='. The padding lets a decoder reconstruct the exact original byte length.

How to encode and decode Base64

  1. 1Choose Encode or Decode. Select Encode to convert text or a file into Base64, or Decode to convert Base64 back into text or a file.
  2. 2Enter your input. Type or paste text, or choose or drop a file of up to 10 MB. To decode, paste Base64: standard or URL-safe, with or without padding, or a whole data: URI.
  3. 3Choose the output format. When encoding, turn on URL-safe to use - and _ without = padding, or Data URI to get a value you can use in src or url().
  4. 4Read the result. The result appears as you type. When decoded data is binary, such as an image, the tool shows its type and size, a hex view, and a Download button.
  5. 5Copy the output. Use Copy output to copy the encoded or decoded result to your clipboard.

Examples

Encode text

Input

Hello, World!

Output

SGVsbG8sIFdvcmxkIQ==

Decode Base64

Input

RGV2VG9vbGJveA==

Output

DevToolbox

URL-safe

With URL-safe on, + and / become - and _, and the = padding is dropped.

Input

Hello?>>

Output

SGVsbG8_Pj4

Data URI

With Data URI on, the output can be used directly in src or url().

Input

Hi

Output

data:text/plain;charset=utf-8;base64,SGk=

Padding

= pads the output to a multiple of four characters.

Input

Hi

Output

SGk=

Base64 alphabet

Base64 maps 6-bit values (0–63) to these 64 characters, plus = for padding.

ValueCharacters
0–25A–Z
26–51a–z
52–610–9
62+ (- in URL-safe)
63/ (_ in URL-safe)
padding=

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is a reversible encoding, not encryption. Anyone can decode it instantly without a key, so it must never be used to protect passwords, API keys, or other secrets.

Why is the encoded output larger than the input?

Base64 encodes every 3 bytes as 4 ASCII characters, so output is about 33% larger than the original. This overhead is the cost of making binary data safe to send as text.

What do the '=' characters at the end mean?

They are padding. Base64 works in blocks of four characters, so one or two '=' are added when the input length is not a multiple of three, signalling how many bytes the final block represents.

What is URL-safe Base64?

A variant defined in RFC 4648 (base64url) that replaces '+' with '-' and '/' with '_', so the value can go in URLs and filenames without escaping. The '=' padding is usually dropped as well, as JWTs do, and this tool's URL-safe option drops it. The decoder accepts URL-safe input with or without padding.

Can I encode images or files?

Yes. Choose a file or drop it on the input to encode its bytes (up to 10 MB), and turn on Data URI to get a value you can use in an img src or a CSS url(). Data URIs embed small images, fonts, and other files directly in HTML or CSS, saving a separate request.

Why does decoding show hex instead of text?

The decoded bytes are binary data, such as an image, a PDF, or a compressed file, rather than UTF-8 text. The tool shows them as a hex dump, names common file types, previews images, and lets you download the decoded file.

Is my data uploaded anywhere?

No. Encoding and decoding run entirely in your browser, and files you choose are read on your device; nothing you enter is sent to or stored on a server. The only exception is the Share link button, which uploads the current output (for a file, its Base64) when you click it.

Is it free?

Yes — free, unlimited, and no sign-up required.

Does Base64 work with Unicode text?

Yes. Text is first converted to bytes using UTF-8, then those bytes are Base64-encoded, so any Unicode characters — including emoji and non-Latin scripts — round-trip correctly.