Base64 Encoder/Decoder

You need a base64 encoder when plain text won’t survive the trip — for example, embedding an image directly inside a CSS file, passing an API key inside a JSON payload, or putting binary data into an HTML data URL. Copying a blob of raw bytes into those places breaks things; base64 turns any data into a safe, text-only string of letters, digits, and a few symbols.

This free base64 encoder and decoder handles both directions live as you type: text to base64 and back, with a URL-safe alphabet toggle, file-to-base64 conversion that reads files on your device (nothing is ever uploaded), one-click copy, and download. This base64 encoder runs entirely in your browser, and error messages are written in plain English, so a broken string tells you what to fix instead of just failing. No signup, no watermarks, everything in your browser.

Base64 Encoder / Decoder

Convert text to base64 and back — live, in your browser.

The file is read on your device and converted to a base64 string you can paste into CSS, JSON, or an API request.

🔒 100% private — everything runs in your browser, nothing is uploaded.

How to Use the Base64 Encoder/Decoder

Whether it is your first time or your fiftieth, these are the steps to base64 encode online with this tool:

  1. Paste or type your text into the Input box. Conversion happens live as you type.
  2. Choose Encode text to base64 or switch to Decode base64 to text to reverse the direction.
  3. Tick URL-safe alphabet if the result will live in a URL, filename, or JWT-style token.
  4. To encode a file, use the file picker under the buttons — the file is read on your device and converted to a base64 string you can drop into CSS, JSON, or an API request.
  5. Click Copy result or Download .txt to take the output with you.
  6. Got a broken string? The tool explains decoding errors in plain English — most failures come from a missing padding character or a mixed-up URL-safe alphabet.

Features That Set This Tool Apart

  • Live two-way conversion — encode and decode in one page, with a one-click swap when you need to reverse direction.
  • URL-safe variant toggle — swaps + and / for - and _ and strips the trailing = padding, exactly as the standard requires.
  • File-to-base64 without uploading — turn an image, font, or document into a base64 string locally, safe for sensitive files.
  • Real Unicode support — text is handled as UTF-8, so emoji, Urdu, Arabic, and other non-ASCII text encode and decode correctly.
  • Readable error messages — instead of a cryptic failure, you get a plain-English explanation of what went wrong.
  • Byte-size readout — see input bytes, output bytes, and the percentage size change at a glance.
  • Made for quick jobs — when you just need to base64 encode online and get back to work, live conversion means zero clicks between pasting and copying.

What Is Base64 Encoding?

Base64 is a way of representing any binary data as plain ASCII text. It takes every 3 bytes of input (24 bits), splits them into four 6-bit groups, and maps each group to one of 64 characters: A–Z, a–z, 0–9, +, and /. When the input length is not a multiple of three, = padding characters fill the final group. Because the output is roughly 33% larger than the input, base64 is a transport encoding, not a compression scheme. Every site that lets you base64 encode online implements this same grouping logic — the difference is only in how clearly it explains errors and how much of your data it asks for.

You will meet base64 everywhere in real development work. Email attachments (MIME) are base64-encoded so they survive mail servers. HTTP Basic authentication headers carry username:password in base64. Data URLs let you embed images directly in HTML and CSS — that long string after data:image/png;base64, is base64. JSON Web Tokens (JWTs) use base64url to pack the header and payload into a URL-safe string. The official definition lives in RFC 4648, while Wikipedia’s Base64 article gives a gentler overview with examples — good background before you run text through this base64 encoder.

One critical point beginners often miss: base64 is not encryption. It offers zero secrecy — anyone can decode a base64 string in seconds. Never base64-encode a password, API secret, or token thinking it is protected. Use it only when the goal is making binary data text-safe, not hiding it.

URL-Safe Base64 vs Standard Base64

Standard base64 uses + and /, both of which have special meaning inside URLs, so pasting a standard base64 string into a query parameter breaks it unless you percent-encode those characters. The URL-safe variant solves this by replacing + with - and / with _, and by dropping the trailing = padding. The two alphabets are not interchangeable — a decoder expecting one will choke on the other.

As a rule of thumb: use standard base64 for email, data URLs, and general storage, and URL-safe base64 for anything that travels in a URL path, query string, or filename. JWTs, OAuth code_challenge values, and signed download links all use the URL-safe flavor. If the place you usually base64 encode online does not offer the URL-safe variant, you end up hand-editing characters — the toggle above converts between the two instantly, which is handy when an API rejects your token with a signature error caused by a + that became a space somewhere along the way.

Base64 Encode Online: Six Mistakes to Avoid

Most frustration with base64 comes from a handful of repeatable errors. When you use a base64 encoder, keep this checklist handy. First, do not confuse encoding with encryption — base64 strings are public, decodable by anyone. Second, match the alphabet: decoding URL-safe base64 with a standard decoder fails, and vice versa. Third, watch the padding: a string whose length is not a multiple of four needs = characters appended before decoding (the tool handles this automatically). Fourth, strip whitespace and line breaks that email clients or chat apps insert into long strings.

Fifth, remember the character encoding: base64 encodes bytes, not characters, so Hello and its UTF-8 byte sequence are the input — decoding to the wrong text encoding produces mojibake like السلام instead of proper text. This tool always uses UTF-8, which matches what modern APIs expect. Sixth, never paste production secrets into any site just to base64 encode online — even though this page runs entirely in your browser, make local encoding a habit for anything sensitive.

A final practical note: base64 inflates data by about a third. Encoding a 3 MB image produces roughly a 4 MB string. For small assets like icons and fonts that is a fine trade-off against an extra HTTP request, but do not inline a multi-megabyte photo into your CSS — the page weight will punish mobile users.

Base64 Encoder/Decoder: Frequently Asked Questions

What is base64 encoding?

Base64 encoding converts any binary data into a text-only string using 64 ASCII characters: uppercase and lowercase letters, digits, plus, and slash. It works by grouping every three input bytes into four 6-bit values, each mapped to one character, with equals signs used as padding when needed. The result is about 33 percent larger than the original, but it can travel safely through systems designed for text, such as email, JSON, and URLs.

Is base64 encryption?

No. Base64 provides no secrecy at all and should never be treated as a security measure. The encoding scheme is public and reversible — anyone can decode a base64 string instantly with any online tool. If someone tells you to base64 encode online to hide a password, that is bad security advice. Use base64 when you need to transport binary data through a text-only channel, and use real encryption, such as AES or TLS, whenever confidentiality actually matters.

How do I decode a base64 string?

Paste the string into the decoder above and switch to the Decode tab. The tool converts it back to readable text instantly. If decoding fails, the most common causes are missing padding characters at the end, stray whitespace or line breaks copied along with the string, or a URL-safe string being decoded with the standard alphabet. The error message will point you toward the specific problem.

What is URL-safe base64?

URL-safe base64 is a variant defined for contexts where the standard plus and slash characters cause trouble, such as URLs and filenames. It replaces plus with a hyphen and slash with an underscore, and it omits the trailing equals padding. JWTs and OAuth flows use this variant. Enable the URL-safe toggle in the tool when your output will appear in a link or a filename.

Why does my decoded text show strange symbols?

That is almost always a character-encoding mismatch, not a base64 problem. Base64 encodes bytes, and those bytes must be interpreted with the right text encoding. If the original text was UTF-8 but you view the decoded bytes as Latin-1 or Windows-1252, non-ASCII characters turn into mojibake. This tool always decodes as UTF-8, which matches what browsers and modern APIs produce, so pasting your string here usually fixes the display.

If you regularly work with APIs, data URLs, or authentication headers, having a reliable place to base64 encode online saves real time — no command-line flags to memorize, no desktop app to install. This page encodes and decodes in both standard and URL-safe alphabets, handles files locally, and never sends your data anywhere. Bookmark it for the next time a token, attachment, or embed needs converting — the fastest way to base64 encode online is the one already open in your browser.