No upload to server Fast Free

Base64 Encode & Decode Online

Convert text to Base64 and back instantly — URL-safe mode and file-to-Base64 included. Private by design: everything runs in your browser.

18 chars in → 24 chars out

Tip: Base64 is encoding, not encryption — anyone can decode it. Never use it to “hide” passwords or secrets. URL-safe mode replaces + / with - _ and strips padding, which is handy for tokens and query strings.

Related guide

Read guide: Base64 encode & decode (URL-safe mode, files, UTF-8) →

Base64 encoder & decoder (free, no signup)

Base64 is one of those quiet workhorses of the internet: a way to represent arbitrary binary data as plain ASCII text so it survives systems that only speak text. Email attachments (MIME), images embedded directly in HTML, API tokens, and JSON payloads carrying files all lean on it. If you have ever stared at a wall of aGVsbG8= in a log file and wondered what it says, you needed a Base64 decoder. If you have ever needed to smuggle an image into a single HTML file, you needed an encoder.

This free converter does both directions instantly, in two modes. The Text tab encodes text to Base64 and decodes Base64 back to text, with a live character count (“5 chars in → 8 chars out”) so you can see the ~33% size overhead Base64 adds. The File → Base64 tab accepts any file up to 25 MB via drag-and-drop and produces a complete data URI like data:image/png;base64,…, ready to paste into HTML, CSS, or JSON. Everything runs on built-in browser APIs — nothing is uploaded, which matters because people routinely paste live API tokens into these tools.

How to use it

  1. Pick a tab: “Text” for strings, “File → Base64” for files.
  2. Pick a direction: “Encode → Base64” or “Decode Base64 →”. Results update live as you type or drop a file.
  3. Toggle URL-safe output if the result will live in a URL, filename, or JWT: it swaps + and / for - and _ and strips the = padding, so nothing needs percent-escaping.
  4. Copy the result with one click.

What Base64 actually is (60-second version)

Base64 takes every 3 bytes of input (24 bits), splits them into four 6-bit chunks, and maps each chunk to one of 64 safe characters (A–Z, a–z, 0–9, +, /). If the input length is not a multiple of 3, = padding fills the gap. That is why encoded output is always about one-third larger than the input, and why it always ends in zero, one, or two = signs. It is encoding, not encryption — anyone can decode it, so never use it to “hide” passwords or secrets.

Real-world scenarios

  • Debugging tokens: paste a JWT's middle segment (or any suspicious string from a log) into Decode to read the payload.
  • Embedding small images: convert a logo or icon to a data URI and inline it in HTML/CSS to cut an HTTP request — best for files under ~50 KB, since Base64 inflates size.
  • API auth headers: HTTP Basic Auth literally sends base64(username:password); encode the pair here when testing APIs by hand.
  • Data URIs in JSON configs: some systems accept files only as data URIs inside JSON. The File tab produces exactly that format.
  • URL-safe tokens: when a token travels in a query string, standard + becomes a space and / breaks routing. URL-safe mode avoids both.

Gotchas worth knowing

  • Decode errors almost always mean a typo, a missing character, or text that was never Base64 (hex strings are the usual impostor). The tool also accepts full data URIs — it strips the data:…;base64, prefix for you.
  • Unicode is handled properly. The encoder uses UTF-8, so emoji and non-Latin scripts (Urdu, Arabic, Chinese) round-trip correctly. Many naive tools call btoa() directly and corrupt anything beyond ASCII — this one does not.
  • Mind the 33% overhead. Base64 is for small payloads; encoding a 10 MB file gives you a ~13 MB string that will choke most text fields.

Safe for secrets (because nothing leaves)

The uncomfortable truth about online encoders: developers paste live credentials into them constantly. With a server-side tool, that token is now on someone else's machine. This converter uses only your browser's built-in encoding APIs, so tokens, keys, and file contents never traverse the network. You can verify it yourself in DevTools' Network tab — it stays silent.

Common use cases

  • Encode API keys or auth tokens for headers and configs
  • Decode a JWT payload or a mysterious string from a log file
  • Convert an image to a data URI for embedding in HTML/CSS
  • Generate URL-safe tokens without manual escaping

If you also format API payloads, pair this with ToolsOfWeb’s JSON Formatter to pretty-print responses before encoding them. For comparing two encoded strings, the Text Diff Checker highlights exactly what changed.

FAQs

No. Base64 is encoding, not encryption — anyone can decode a Base64 string. It only makes binary data safe to transport as text. Never use it to “hide” passwords or secrets.

No. Encoding and decoding run entirely in your browser using built-in JavaScript APIs. Your data never leaves your device.

Standard Base64 uses + and /, which need escaping in URLs. URL-safe mode replaces them with - and _ and strips padding (=), so the output works directly in query strings, filenames, and tokens like JWTs.

Usually a typo, a missing character, or pasted text that is not Base64 at all (for example, a hex string). The tool also accepts data URIs — it strips the “data:…;base64,” prefix automatically.

Yes. Use the “File → Base64” tab and drop in an image (or any file up to 25 MB). You get a full data URI like data:image/png;base64,… ready to embed in HTML, CSS, or JSON.

Yes. The encoder uses UTF-8, so emoji, Urdu, Arabic, Chinese, and other Unicode text encode and decode correctly. Many simple tools break on these because they use btoa directly on raw strings.

More free tools

Want guides and tips? Visit the ToolsOfWeb blog or go back to the homepage.

Related guide

Read guide: Base64 encode & decode (URL-safe mode, files, UTF-8) →