🔄 Base64 Encoder / Decoder

Text & file encoding · URL-safe · Line breaks · Instant conversion

Base64 Quick Facts

Alphabet
A–Z, a–z, 0–9, +, /
URL-safe alphabet
A–Z, a–z, 0–9, -, _
Padding
= (1 or 2 chars)
Size overhead
~33% larger than input
Line length (MIME)
76 chars per line
Bits per char
6 bits → 1 char

What is Base64 Encoder / Decoder?

Base64 Encoder / Decoder converts text and binary data to Base64 format and decodes Base64 strings back to their original content. It supports standard Base64 (RFC 4648), URL-safe Base64 (using - and _ instead of + and /), and MIME-style line-wrapped output. All processing happens in your browser — nothing is sent to a server.

Base64 encoding maps every 3 bytes of input to 4 printable ASCII characters chosen from A-Z, a-z, 0-9, +, and /. This 33% expansion allows binary data to travel safely through text-only channels such as email, JSON APIs, and HTML attributes. It is used to embed images directly in CSS (url('data:image/svg+xml;base64,...')), encode binary payloads in JSON, and pass credentials in HTTP Basic Authorization headers (Authorization: Basic dXNlcjpwYXNz).

Base64 is not encryption. Any tool can decode it instantly. Its sole purpose is safe transport of binary data as text. Do not use it to hide or protect sensitive values.

How to Use

  1. Paste text or a Base64 string into the input area.
  2. Click 'Encode' to convert to Base64, or 'Decode' to reverse the process.
  3. Toggle 'URL-safe' mode if the output will appear in a URL, filename, or JWT.
  4. Use 'Line breaks' to wrap output at 76 characters (MIME/email format).
  5. Click the copy button to copy the result to clipboard.

Examples

Encode 'Hello, World!'

Result: SGVsbG8sIFdvcmxkIQ==

HTTP Basic Auth header

Result: Credentials 'user:secret' encode to dXNlcjpzZWNyZXQ= → Authorization: Basic dXNlcjpzZWNyZXQ=

Data URI for a CSS background image

Result: data:image/svg+xml;base64,[encoded-svg] — inline the SVG without a separate HTTP request

Frequently Asked Questions

Is Base64 encrypted?

No. Base64 is a reversible encoding with no key. Anyone can decode it. Use it for transport, not protection.

Why does Base64 end with == or =?

Base64 groups input into 3-byte chunks. If the final chunk has 1 or 2 bytes, padding characters (=) fill the output to a multiple of 4.

What is URL-safe Base64?

Standard Base64 uses + and / which are reserved in URLs. URL-safe Base64 replaces them with - and _ making the string safe in URL segments and JWT tokens without percent-encoding.

How do I embed an image as a data URI?

Encode the image as Base64 then use src='data:[mime];base64,[encoded]'. Best for small images under 4 KB.

How much larger is Base64 output?

Approximately 33% larger — every 3 input bytes become 4 output characters. A 100 KB image becomes ~133 KB as Base64.

Related Tools