Base64 Encoder & Decoder

Encode and decode Base64 strings instantly. Convert text, images, and files to Base64.

About Base64

Encode text, images, or any binary file to Base64 and decode it back — all in the browser. Useful for embedding assets as data URIs, preparing HTTP Basic Auth headers, inlining icons in emails, or decoding an unfamiliar payload from an API. Handles UTF-8 correctly (unlike the buggy btoa() used naively), and supports both standard and URL-safe variants.

Base64 encoding represents any byte sequence using only 64 printable ASCII characters, so binary data can travel through channels designed for text: HTTP headers, JSON, XML, email bodies, CSS url() attributes. The tradeoff is a 33% size overhead — three bytes become four characters.

The most common pitfalls with Base64 involve character encoding. Naive btoa() in JavaScript fails on any non-ASCII string because it only accepts Latin-1. This tool handles UTF-8 correctly, so emoji, non-Latin scripts, and accented characters round-trip properly. It also supports URL-safe Base64 (RFC 4648 §5), where + and / are replaced with - and _ and padding is stripped — required for JWT tokens, some OAuth flows, and most cookie values.

For file uploads, the tool reads the file locally via the FileReader API and produces a data URI you can paste directly into an <img src>, a background-image CSS rule, or a JSON payload.

How to use the Base64
  1. 1

    Choose encode or decode

    Switch modes depending on direction. Encode goes from readable text or a file into Base64. Decode reverses it.

  2. 2

    Provide your input

    Paste text, drop a file, or upload an image. The file reader stays in your browser — no upload to a server.

  3. 3

    Pick standard or URL-safe

    Standard Base64 uses +, /, and = padding. URL-safe replaces + with -, / with _, and drops padding. Use URL-safe for JWTs, cookies, and anything embedded in a URL.

  4. 4

    Copy the result

    One click copies the encoded string or decoded text. For files, the result is shown as a data URI ready to embed.

Common use cases

Embedding small images

Inline logos or icons as data URIs in CSS or HTML to eliminate an extra HTTP request.

HTTP Basic Auth

Encode user:password pairs for the Authorization header when testing APIs with curl or Postman.

Decoding JWT payloads

Use the URL-safe mode to decode the middle segment of a JWT and inspect its claims.

Email attachment inspection

Many raw email formats encode attachments in Base64. Paste the block to see the original file.

Frequently asked questions
Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone can decode it trivially. Never use Base64 alone to protect sensitive data — combine it with real encryption (like AES) or transport security (HTTPS).

Why does my emoji break after encoding?

If you used JavaScript's built-in btoa(), it only accepts Latin-1 and silently corrupts multi-byte UTF-8. This tool handles UTF-8 correctly — emoji, Arabic, Chinese, and any other non-ASCII text round-trip without data loss.

What's the difference between standard and URL-safe Base64?

Standard Base64 uses the characters + and /, which have special meaning in URLs. URL-safe variants (RFC 4648 §5) replace them with - and _, and usually drop the = padding. JWTs, many OAuth tokens, and cookies use URL-safe encoding.

Can I encode a large file?

Yes, but expect a 33% size increase and memory use proportional to file size. Files over about 100 MB may slow down the browser. For very large files, prefer streaming tools like `base64` on the command line.

Does Base64 output always end with = signs?

Only when padding is required. Base64 pads the output to a multiple of 4 characters. URL-safe Base64 typically omits padding — some parsers accept either form, others require exact conformance.

developerencodingconverterweb