# Base64 Encoder / Decoder

> One page from jmrp.io, published as markdown. Index: https://jmrp.io/llms.txt

Canonical: https://jmrp.io/tools/base64-encoder/
Language: en
Alternate: https://jmrp.io/es/tools/base64-encoder/index.md
Updated: 2026-08-25
License: https://jmrp.io/license/
Category: developer
Tags: base64, encoding, decoding, hex, url-encoding

Encode and decode Base64, Base64URL, URL encoding, hex, and HTML entities. File support for images and documents. Runs client-side.
Build-Date: 2026-09-06

Features:
- Encode and decode Base64 and Base64URL
- Convert URL, hex, HTML entities, and binary
- Encode files via drag-and-drop with preview
- Generate Data URIs for CSS and HTML
- Runs fully client-side, no uploads

Questions answered:

**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](https://datatracker.ietf.org/doc/html/rfc4648)) 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.


---

**Interactive tool** — this page hosts the working application itself, not a description of one.

## 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

```bash
echo -n "Hello, World!" | base64
```

**Base64 Output**

```text
SGVsbG8sIFdvcmxkIQ==
```

```bash
echo "SGVsbG8sIFdvcmxkIQ==" | base64 --decode
```

**Plain Text Output**

```text
Hello, World!
```

#### Files ↔ Base64

```bash
base64 -w0 image.png > image.b64
```

**Output — Binary to Base64**

```text
(The command writes image.b64 with the content on a single line)
```

```bash
base64 --decode image.b64 > restored.png
```

**Output — Base64 to Binary**

```text
(Restores the original file from its Base64 representation)
```

#### Data URI for CSS / HTML

```bash
echo "data:$(file -b --mime-type logo.png);base64,$(base64 -w0 logo.png)"
```

**Data URI Output**

```text
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
```

#### Other Encodings

```bash
python3 -c "import urllib.parse; print(urllib.parse.quote('Hello World! á€'))"
```

**Output — URL Encoded**

```text
Hello%20World%21%20%C3%A1%E2%82%AC
```

```bash
echo -n "Hello" | hexdump -ve '1/1 "%.2x"'
```

**Hexadecimal Output**

```text
48656c6c6f
```

#### Verify Integrity

```bash
sha256sum original.pdf
base64 -w0 original.pdf | base64 --decode > roundtrip.pdf
sha256sum roundtrip.pdf
```

**Output — Integrity Verification**

```text
3fdd704b45cbc536d98c5c7df2636f1a895c7f72a66f3bb5ea2d1daa26eb5e7a  original.pdf
3fdd704b45cbc536d98c5c7df2636f1a895c7f72a66f3bb5ea2d1daa26eb5e7a  roundtrip.pdf
```

```bash
head -c 32 file.b64 | base64 --decode | file -
```

**Output — Magic Bytes Detection**

```text
/dev/stdin: PNG image data, 800 x 600, 8-bit/color RGBA
```

