Base64 encoder & decoder

Encode text or files to Base64, or decode Base64 back to plain text. Supports standard and URL-safe variants, plus image preview and data URI generation.

Text to encode

Clear
What is Base64?

Encoding binary as text

Base64 converts binary data (files, images, arbitrary bytes) into a string of 64 ASCII characters. Every 3 bytes of input become 4 characters of output, increasing size by ~33%.

Common uses

Where you'll encounter it

Email attachments (MIME), embedding images in HTML/CSS as data URIs, encoding binary data in JSON APIs, Basic Auth headers (Authorization: Basic user:pass), and JWT tokens.

URL-safe variant

Base64URL

Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces them with - and _ and omits the = padding. Used in JWTs and OAuth tokens.

PHP functions

Using Base64 in PHP

base64_encode($str) — encode.
base64_decode($str) — decode.
For URL-safe: strtr(base64_encode($s), '+/', '-_')

Working with APIs, JWTs, or file handling in PHP?

Our PHP developer ebooks cover real-world patterns including authentication, file processing, and API integration.

Browse ebooks → View courses →

This Is For Traffic Exchange Only