iLoveDocsTools
All ToolsEncode / Decode Base64

Encode / Decode Base64

Encode plain text to Base64 or decode Base64 back to text. Handles Unicode and special characters.

?

FREE

Loading…

Go Pro ↑
Your files never leave your device. All processing happens locally in your browser — nothing is uploaded to our servers.Files are never stored on our servers · No tracking of your file contentsPrivacy Policy

What is Encode / Decode Base64?

Encode/Decode Base64 is a free online tool that encodes plain text to Base64 format or decodes Base64 back to readable text. Base64 is one of the most common encodings in web development, and understanding what it actually does — and doesn't do — matters for using it correctly.

Base64 is a binary-to-text encoding scheme: it takes arbitrary bytes and represents them using only 64 printable ASCII characters (A-Z, a-z, 0-9, plus + and /), which makes the result safe to embed anywhere that expects plain text — a JSON field, an XML document, an HTTP header, or a URL — without worrying about unprintable control characters or encoding mismatches corrupting the data in transit. It works by regrouping input bytes into 6-bit chunks (since 2^6 = 64) instead of the usual 8-bit bytes, then mapping each 6-bit value to one of the 64 allowed characters; because 3 bytes (24 bits) divide evenly into four 6-bit groups, Base64 output is always a multiple of 4 characters, padded with = when the input isn't a clean multiple of 3 bytes.

You'll run into Base64 constantly in real systems: a data URI like data:image/png;base64,iVBORw0KG... embeds an entire image directly inside HTML or CSS with no separate file request; the header.payload.signature structure of a JWT has its first two segments Base64URL-encoded JSON, which is why anyone can read (though not forge) a JWT's claims without a library; HTTP Basic Authentication sends credentials as Authorization: Basic <base64 of user:pass>; and email systems have used Base64 (specifically the MIME standard) since the 1990s to safely transmit binary attachments over protocols originally designed only for 7-bit ASCII text.

The single most important thing to understand about Base64 is that it is encoding, not encryption. There is no secret key involved, and no cryptographic transformation happens — any Base64 string can be decoded back to its original bytes instantly by anyone, with no password required. Seeing Base64 in a config file, a cookie, or a URL parameter should never be read as a security measure; it's purely a format-compatibility trick for making binary or special-character data safe to transport as plain text.

Everything here processes as plain UTF-8 text. This tool correctly round-trips Unicode characters — accented letters, CJK text, emoji — by percent-encoding them before the browser's native btoa() call and reversing that with decodeURIComponent after atob(), since btoa() alone only supports the Latin-1 character range and throws on anything outside it. All processing happens locally in your browser tab; nothing you type is ever transmitted to a server.

How It Works

Encoding first runs your text through encodeURIComponent to percent-escape any character outside the Latin-1 range, then unescape to convert those percent sequences into raw Latin-1 bytes, and finally passes the result to the browser's native btoa() function, which performs the actual Base64 transformation. Decoding reverses this exact chain: atob() converts the Base64 string back to a raw byte string, escape() re-encodes any byte above 127 into percent-escaped form, and decodeURIComponent reconstructs the original Unicode text from those escapes. This three-step chain — rather than calling btoa()/atob() directly — is specifically what allows the tool to handle any Unicode input correctly instead of throwing an InvalidCharacterError, which is what plain btoa() does the moment it encounters a character outside Latin-1.

How to Use

  1. 1

    Paste text or binary data

    Enter the text you want to encode, or paste a Base64 string you want to decode.

  2. 2

    Encode or decode

    Click "Encode to Base64" to convert text to Base64, or "Decode from Base64" to reverse the operation.

  3. 3

    Copy the result

    Copy the encoded or decoded output to your clipboard for use in code, APIs, or emails.

  4. 4

    Encode files (optional)

    Use the Encode Image to Base64 tool to convert image files to Base64 data URLs for embedding in HTML or CSS.

Who Uses This Tool

🔑

HTTP Basic Authentication

Encode "username:password" to Base64 for use in the Authorization: Basic header of HTTP requests.

🖼️

Data URI Inspection

Decode a data:image/png;base64,... URI to inspect or extract the raw bytes of an embedded image.

📧

Email Attachment Encoding

Encode binary attachment content to Base64 to embed it safely within MIME-formatted email messages.

🔐

JWT Payload Reading

Decode the Base64URL-encoded middle section of a JWT token to read its JSON payload without a library.

📦

API Payload Encoding

Encode binary or Unicode content to Base64 so it can be transmitted safely through JSON API fields.

🛠️

Debugging Encoded Strings

Quickly decode an unknown Base64 string encountered in logs, configs, or source code to see its raw value.

Why Choose This Tool

Unicode Support

Handles multi-byte Unicode characters correctly using percent-encoding before the btoa call, preventing encoding failures.

Clear Error Messages

Invalid Base64 input produces a descriptive error rather than silently returning garbage, so issues are immediately obvious.

One-Click Mode Switch

Toggle between encode and decode modes with a single button tap without clearing your existing text.

Instant Processing

Encoding and decoding run synchronously in the browser so results appear the moment you click.

No Size Limit

Handles arbitrarily long strings in the browser without any file-size restrictions or timeouts.

Private by Default

No text is ever sent to a server, making this safe for encoding credentials, tokens, and sensitive payloads.

Key Benefits

  • Encode or decode with a single click
  • Correctly handles Unicode text — accented letters, CJK, emoji
  • Shows clear, specific error messages for invalid or malformed Base64 input
  • Standard alphabet output (A-Z, a-z, 0-9, +, /) with correct = padding
  • Copy output instantly with one click
  • No data leaves your browser — safe for credentials and tokens

Frequently Asked Questions

Also Known As

base64 encoder decoder online freeencode text to base64 onlinedecode base64 string onlinebase64 converter browser basedonline base64 encode decode toolbase64 decoder no installconvert text to base64 onlinebase64 encoding tool free

Trusted Worldwide

Free Online Document Tools for Everyone

iLoveDocsTools is used by students, professionals, and businesses across the United States, Canada, United Kingdom, Australia, India, and more than 100 other countries. All tools are browser-based and process files privately — your files never leave your device. Free to use, with Pro plans for unlimited access.

No Upload Required

All processing happens directly in your browser. Your documents are never sent to any server — complete privacy guaranteed for users in the USA, Canada, UK, and worldwide.

Free to Use — Pro Plans Available

Every tool on iLoveDocsTools is free to use. Need more? Upgrade to Pro for unlimited usage, priority access, and no daily limits. Trusted by students, freelancers, and teams across North America and Europe.

Works on Any Device

Whether you are on a Mac, Windows PC, iPhone, or Android in New York, Toronto, London, or Sydney — our tools work instantly in any modern browser.

Looking for free PDF tools in the USA? Free document converters in Canada? Online PDF editors in the UK or Australia? iLoveDocsTools offers 70+ free tools — merge PDF, split PDF, compress PDF, convert Word to PDF, Excel to PDF, JPG to PDF, and many more — all free, all instant, all private. No watermarks. No file size limits. Just free tools that work.