Base64 & Encoding Tool
Input
0 bytes
Output
...
0 bytes

About This Tool

A multi-format encoder and decoder supporting the most common encoding schemes used in web development, APIs, and data exchange. Now with full file support for images, audio, video, documents, and any binary file.

Supported Formats

  • Base64 — standard RFC 4648 encoding
  • Base64URL — URL-safe variant used in JWTs
  • URL Encoding — percent-encoding for URLs
  • Hexadecimal — hex string encoding
  • HTML Entities — HTML character escaping
  • Binary — binary string representation

File Support

  • Images — PNG, JPEG, GIF, WebP, SVG (with preview)

  • Audio — MP3, OGG, WAV (with player)
  • Video — MP4, WebM (with player)
  • Documents — PDF, JSON, plain text, and any other file

How do I use it?

  1. Switch between Text and File mode using the tabs

  2. In Text mode: paste text and select input/output encoding formats
  3. In File mode: drop a file or click to browse, then copy the Base64 output

  4. Toggle the Data URI prefix for ready-to-use CSS/HTML embedding
  5. Use the Download button to save decoded Base64 back as a file

Is my data private?

All encoding and decoding happens entirely in your browser. No files are uploaded to any server. Your data never leaves your device.

How do I do this from the Linux terminal?

You can achieve the same operations from the terminal using built-in Linux tools. Here are the most common examples:

Text ↔ Base64

echo -n “Hello, World!” | base64
SGVsbG8sIFdvcmxkIQ==
echo “SGVsbG8sIFdvcmxkIQ==” | base64 —decode
Hello, World!

Files ↔ Base64

base64 -w0 image.png > image.b64
(The command writes image.b64 with the content on a single line)
base64 —decode image.b64 > restored.png
(Restores the original file from its Base64 representation)

Data URI for CSS / HTML

echo "data:$(file -b --mime-type logo.png);base64,$(base64 -w0 logo.png)"
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…

Other Encodings

python3 -c "import urllib.parse; print(urllib.parse.quote('Hello World! á€'))"
Hello%20World%21%20%C3%A1%E2%82%AC
echo -n “Hello” | hexdump -ve ‘1/1 “%.2x”’
48656c6c6f

Verify Integrity

sha256sum original.pdf
base64 -w0 original.pdf | base64 --decode > roundtrip.pdf
sha256sum roundtrip.pdf
3fdd704b45cbc536d98c5c7df2636f1a895c7f72a66f3bb5ea2d1daa26eb5e7a original.pdf3fdd704b45cbc536d98c5c7df2636f1a895c7f72a66f3bb5ea2d1daa26eb5e7a roundtrip.pdf
head -c 32 file.b64 | base64 —decode | file -
/dev/stdin: PNG image data, 800 x 600, 8-bit/color RGBA

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is an encoding scheme, not encryption. It makes binary data safe to transmit as text but provides no confidentiality, since anyone can decode it instantly. Never use it to protect secrets.

What is the difference between Base64 and Base64URL?

Standard Base64 (RFC 4648) uses + and / characters plus = padding, which can break inside URLs. Base64URL replaces them with - and _ and usually drops the padding, making it safe for URLs and JWTs.

Is my data uploaded to a server when I encode a file?

No. All encoding and decoding runs entirely in your browser. Files you drop are never uploaded, so your data never leaves your device.

Why is my Base64 output larger than the original file?

Base64 represents every 3 bytes of input as 4 ASCII characters, so the output is roughly 33% larger than the source data. This is expected overhead for any Base64 encoding.

What is a Data URI and when should I use it?

A Data URI embeds the Base64-encoded content directly inside CSS or HTML using a data:<mime-type>;base64,... prefix, avoiding a separate file request. Enable the Data URI toggle to get a ready-to-paste string for small assets like icons.