Home/Tools/Developer Tools/Base64 Encoder Decoder

Base64 Encoder Decoder

Developer Tools

Encode and decode Base64 strings instantly.

⚡ Instant🔒 Private, in your browser🆓 Free, no sign-up👥 For developers
Your data never leaves your browser. We do not store inputs.

What Base64 Encoder Decoder does

The Base64 Encoder Decoder converts text or files to Base64 and decodes Base64 back to text. It handles UTF-8 correctly (accents, non-Latin scripts and emoji), supports URL-safe Base64, accepts line-wrapped or unpadded input, and runs entirely in your browser.

FV
Reviewed by the FreeToolsVerse team · Last updated · How we check our tools

Features and benefits

  • Converts binary-unsafe text into a format that survives being pasted into JSON, XML, URLs, or email without breaking
  • Decodes Base64 strings pulled from API responses, JWT tokens, or data URIs back into readable text
  • Handles both directions in one tool, so you don't need separate encode and decode utilities
  • Instant, client-side conversion — no round trip to a server while you're debugging
  • Useful for spot-checking what's actually inside a data URI or header without writing code

How to use Base64 Encoder Decoder

  1. Choose Encode or Decode
  2. Type or paste your text (or choose a file to encode), or paste the Base64 string to decode
  3. Optionally turn on URL-safe output or 76-character line wrapping when encoding
  4. Copy the result, or use it as the next input

Who should use it

Made for developers. Typical uses:

  • Encoding binary data for email and web transmission
  • Embedding images or files in HTML, CSS, or JSON
  • Decoding Base64 strings received from APIs or data sources

Example

Encoding the plain text "Hello" produces the Base64 string "SGVsbG8=" — the "=" at the end is padding, added because Base64 always outputs in 4-character blocks and "Hello" doesn't divide evenly into 3-byte chunks. Paste "SGVsbG8=" back into the decoder and it returns "Hello" exactly, since Base64 is fully reversible with no data loss.

Limitations and accuracy

Base64 is an encoding, not encryption, so anyone can decode it. Decoded binary data such as images is offered as a download rather than shown as text. Files up to 20 MB can be encoded.

Accuracy: Output is tested against known inputs. For production code, review the result and run your own tests.

Expert Tip

If a decoded result looks like garbage, check whether the source used URL-safe Base64 (which swaps + and / for - and _) — standard decoders can fail on those characters until you convert them back.

Frequently asked questions

Is Base64 secure?
No. Base64 only makes data safe to put in text formats; anyone can decode it instantly. Never use it to hide passwords or secrets.
What is URL-safe Base64?
It replaces + and / with - and _ and drops the = padding so the result can be used in URLs and tokens such as JWTs. The decoder accepts both forms automatically.
Does it handle emoji and accented characters?
Yes. Text is encoded as UTF-8 first, so characters like é, 世 and emoji encode and decode correctly.
Is my data uploaded?
No. Encoding and decoding happen locally in your browser.

Base64 Encoder Decoder: the complete guide

What Base64 is

Base64 represents any data using 64 safe characters: the letters A to Z and a to z, the digits 0 to 9, plus and slash, with equals signs as padding. It exists because many systems, such as email and JSON, can carry text but not raw bytes. Encoding turns bytes into text and decoding turns the text back into bytes. Every 3 bytes become 4 characters, so the text is about a third bigger.

The Base64 Encoder Decoder handles both directions and treats your text as UTF-8, so accents, non-Latin scripts and emoji survive.

Examples you can check

These results come straight from the encoder.

  • Hello encodes to SGVsbG8=.
  • Hello, World! encodes to SGVsbG8sIFdvcmxkIQ==.
  • Café ☕ encodes to Q2Fmw6kg4piV, because the accented letter and the symbol take several bytes each in UTF-8.
  • Decoding SGVsbG8= returns Hello.

Options

Two checkboxes change how the output is written.

  • URL-safe replaces plus and slash with dash and underscore and drops the equals padding, so the result can sit in a URL or a file name. SGVsbG8= becomes SGVsbG8.
  • Wrap at 76 characters inserts line breaks every 76 characters, the layout used by MIME email.

Encoding files

You can also choose a file to encode, up to 20 MB, which is how images and documents are embedded in JSON, CSS or email. Decoding data that is not text, such as an image, offers the result as a download instead of showing unreadable characters. For images specifically, the Image to Base64 tool produces ready-to-paste data URIs and HTML.

Base64 is not encryption

Anyone can decode Base64 in a second, so never use it to hide a password or a secret. It is also not a hash: a hash cannot be reversed, but Base64 can. Base64, hashing and encryption: what is the difference? explains where each belongs. To create a one-way fingerprint of text, use the Hash Generator, and to percent-encode text for a URL use the URL Encoder Decoder.

All encoding and decoding happens in your browser, and nothing is uploaded.

Where you meet Base64

Base64 appears in more places than most people notice. Email attachments travel as Base64 inside the message. Data URIs embed small images in HTML and CSS. JSON Web Tokens use a URL-safe form to carry their header and payload. APIs often accept a file as a Base64 string in a JSON body, and some services return one. HTTP basic authentication sends the user name and password joined by a colon and encoded in Base64, which is encoding for transport and not protection, so it must only ever be used over HTTPS.

Common mistakes

Decoding fails when the text has been cut off, when line breaks were added or lost, or when the standard and URL-safe alphabets are mixed up. The tool accepts line-wrapped and unpadded input, which covers most copy-and-paste damage. If the result is unreadable, the data may not have been text in the first place, which is why a decoded file is offered as a download. Always compare the length: a valid Base64 string without padding has a length that leaves a remainder of 2 or 3 when divided by 4.

Learning resources

Explore more in Developer Tools, read the guides and articles, or see how we test our tools.

Share This Tool