Base64 Encoder/Decoder

Easily encode and decode text to and from Base64 format.

Base64 is one of the most widely used binary-to-text encoding schemes in modern web development. This free online Base64 encoder and decoder lets you instantly convert any text, JSON payload, or binary string into its Base64 representation and back again. All processing runs entirely in your browser — no data is ever sent to a server, ensuring complete privacy for sensitive content such as API keys, tokens, or personal information.

Your data stays in your browser
Tutorial

How to use

1
1

Usage Step

Easily encode and decode text to and from Base64 format.

Guide

Complete Guide to Base64 Encoding and Decoding

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme defined in RFC 4648 that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, + and /). Every three bytes of input map to four Base64 characters, with = used as padding. Originally designed for MIME email attachments, Base64 has become essential across web development, APIs, and data storage since it can travel through any text-based transport layer without corruption.

Why Base64 Matters in Web Development

Modern web applications rely on Base64 in countless scenarios. Data URIs embed small images and fonts directly into HTML or CSS, eliminating extra HTTP requests. JWTs encode header and payload as Base64url strings. REST and GraphQL APIs accept file uploads as Base64-encoded strings inside JSON bodies. Email protocols use Base64 for SMTP attachments. Understanding Base64 is a core skill for any developer working with data transfer.

Key Concepts: Standard vs URL-Safe Base64

Standard Base64 uses + and / as its 63rd and 64th characters, plus = for padding. These characters have special meaning in URLs and file systems. Base64url (RFC 4648 section 5) replaces + with - and / with _, and typically omits padding. When embedding tokens in URLs or filenames, always use Base64url to avoid encoding conflicts.

Best Practices for Using Base64

Base64 increases data size by about 33 percent, so avoid encoding large files unless necessary. Only inline images under 10 KB; larger files benefit from browser caching. Never use Base64 as encryption — it is reversible by anyone. When handling Unicode, encode to UTF-8 first then Base64-encode the resulting bytes to avoid corrupting multi-byte characters.

Examples

Worked Examples

Example: Encoding a Simple String

Given: the plain-text string Hello, World!

1

Step 1: Convert each character to its ASCII byte value (H=72, e=101, l=108, etc.).

2

Step 2: Group bytes into 3-byte blocks and convert each block to four 6-bit indices.

3

Step 3: Map each index to the Base64 alphabet and pad the final group with = characters.

Result: SGVsbG8sIFdvcmxkIQ==

Example: Decoding a JWT Payload

Given: Base64url JWT payload eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0

1

Step 1: Replace URL-safe characters: - becomes + and _ becomes /.

2

Step 2: Add = padding until length is a multiple of 4.

3

Step 3: Decode the standard Base64 string to obtain the original JSON bytes.

Result: {"sub":"1234567890","name":"John Doe"}

Use Cases

Use cases

Embed Images in HTML/CSS

Convert small PNG or SVG icons to Base64 data URIs and embed them directly in your stylesheets or HTML markup. This eliminates an extra HTTP round-trip for each asset, which is particularly beneficial on high-latency mobile connections. Keep this technique for icons under 10 KB to avoid bloating your CSS bundle size.

Encode API Payloads

Many REST APIs require binary data such as PDF reports or profile photos to be sent inside JSON request bodies. Base64 encoding the file allows you to include it as a simple string field without multipart form handling. Remember to set the correct Content-Type header and decode on the server side before writing to storage.

Decode JSON Web Tokens

JWTs consist of three Base64url-encoded segments separated by dots. Paste the middle segment into this tool to quickly inspect the payload claims — user ID, expiration time, scopes, and custom fields — without installing a dedicated JWT debugger or writing any additional code.

Transmit Email Attachments

SMTP email protocols rely on MIME encoding which uses Base64 to safely transport binary attachments through text-only channels. If you need to inspect or manually construct a MIME-encoded message for debugging, this tool lets you encode and decode individual attachment blocks instantly and privately.

Frequently Asked Questions

?What is Base64 encoding and how does it work?

Base64 is a binary-to-text encoding (RFC 4648) that converts every three bytes of input into four ASCII characters from a 64-character alphabet. It is used to transmit binary data through text-only channels like email, JSON, or URLs.

?How do I encode text to Base64 online?

Paste your text into the input field and click Encode. The result appears instantly. Copy it with one click. No sign-up or installation required.

?What is the difference between Base64 and Base64url?

Standard Base64 uses + and / plus = padding. Base64url replaces them with - and _ and omits padding, making it safe for URLs and filenames. JWTs and OAuth tokens use Base64url.

?Does Base64 encoding increase file size?

Yes, by approximately 33 percent since every 3 input bytes become 4 output characters. Avoid Base64 for large files when direct binary transfer is possible.

?Is Base64 the same as encryption?

No. Base64 is a reversible encoding, not encryption. Anyone can decode without a key. Use AES or RSA for protecting sensitive data.

?Is this Base64 tool free to use?

Yes, 100 percent free with no registration, no limits, and no ads.

?Is my data safe? Does the tool send anything to a server?

Your data never leaves your device. All processing runs locally in your browser via JavaScript. No network requests are made.

?Can I encode Unicode and special characters?

Yes. The tool handles UTF-8 text including accented letters, emojis, and CJK characters. Text is first converted to UTF-8 bytes, then Base64-encoded.

Related Tools

Help us improve

How do you like this tool?

Every tool on Kitmul is built from real user requests. Your rating and suggestions help us fix bugs, add missing features and build the tools you actually need.

Rate this tool

Tap a star to tell us how useful this tool was for you.

Suggest an improvement or report a bug

Missing a feature? Found a bug? Have an idea? Tell us and we'll look into it.

Recommended Reading

Recommended Books on Data Encoding & Web Development

As an Amazon Associate we earn from qualifying purchases.

Boost Your Capabilities

Professional Products to Boost Your Development Setup

As an Amazon Associate we earn from qualifying purchases.

Newsletter

Get Free Productivity Tips & New Tools First

Join makers and developers who care about privacy. Every issue: new tool drops, productivity hacks, and insider updates — no spam, ever.

Priority access to new tools
Unsubscribe anytime, no questions asked