DevToolbox

Base64 Encoder

Encode and decode Base64 strings instantly

InputPaste or type text
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 and decodes Base64 entirely in your browser — nothing is sent to any server.

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 integrity use a hash or a 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 plain text into Base64, or Decode to convert Base64 back into readable text.
  2. 2Enter your text. Paste or type your input. For encoding, enter any text; for decoding, paste a valid Base64 string.
  3. 3Read the result. The converted value appears instantly in the output panel as you type.
  4. 4Copy 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

Data URI for an image

Base64 embeds binary assets directly in markup.

Input

<img src="data:image/png;base64,iVBORw0KGgo...">

Output

Renders the image with no separate file request

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 that replaces '+' with '-' and '/' with '_' so the encoded string can be used in URLs and filenames without extra escaping. The rest of the alphabet is identical.

Can I encode images or files?+

Yes. Base64 is commonly used to embed images, fonts, and other binary files as data URIs directly in HTML or CSS, removing a separate network request for small assets.

Is my data uploaded anywhere?+

No. Encoding and decoding run entirely in your browser. Nothing you enter is sent to or stored on a server.

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.