Base64 Encoder/Decoder

Encode and decode Base64 strings and files.

What Base64 Encoder/Decoder helps you do

Encode text or small files to Base64 strings, or decode Base64 back to readable text and downloadable files. Handy for API payloads, data URLs, config snippets, and debugging encoding pipelines. It is a two-way converter, so the same page can confirm that a value round-trips before you paste it into a request.

Encoding and decoding run in your browser. Content is not sent to Haivix servers.

How it works

Text is converted to UTF-8 bytes and then encoded with the standard Base64 alphabet and padding. Files are read as bytes and encoded the same way. Decoding reverses the process and validates the padding and character set, so a malformed string fails visibly instead of producing a plausible-looking but corrupted result.

How to use Base64 Encoder/Decoder

  1. Paste text or drop a file, then choose encode or decode.
  2. Copy the Base64 output or download decoded bytes when working with files.
  3. Decode the result again if you need to confirm a clean round trip.
  4. Check that a data URL prefix is removed before decoding its payload.

When to use it

  • Embed small assets as data URLs in HTML or CSS prototypes.
  • Inspect Base64 fragments returned by REST APIs or JWT segments.
  • Convert binary test fixtures to text-safe strings for logs or tickets.
  • Pass a small file through a JSON field that only accepts text.
  • Check whether an API value is Base64 or Base64url before decoding.
  • Confirm that a certificate or key fragment survived a copy-paste.

When not to use it

  • Do not use Base64 as encryption; it is an encoding, not a protection.
  • Do not encode a large file for a URL or a log line; the string grows by about a third.
  • Do not assume URL-safe Base64 will decode without replacing - and _.

Example

An API returns a small PNG as a Base64 field. Pasting the value and decoding it produces a binary result, which is downloaded as a PNG and opened to confirm it is the expected icon. The original Base64 string is kept in the API notes for reference.

What you can do with Base64 Encoder/Decoder

  • Encode text to standard Base64.
  • Decode Base64 back to text.
  • Encode a dropped file to a Base64 string.
  • Decode Base64 bytes and download the recovered file.
  • Reject invalid padding instead of producing garbage.
  • Keep the input and output on your device.
  • Round-trip a value to confirm it survives.

Example: inspect a data URL

Paste the Base64 part of a data URL and decode it to see whether it is text, JSON or binary. A decoded text fragment is readable; a binary result should be downloaded rather than copied.

For a small icon or fixture, drop the file, encode it, and copy the string into the CSS or JSON that needs it. Keep the source file; the data URL is not a backup.

Round-trip the value once before shipping. Encoding and decoding the same content should return the original bytes exactly.

What to know before you start

  • Standard Base64 output is not URL-safe without converting + and /.
  • Very large files can exhaust browser memory because the whole string is held in the page.
  • The tool does not validate that decoded bytes form a usable image, archive or document.
  • It does not encrypt or sign the content.
  • Line wrapping is not applied to the output.

Common mistakes

  • Leaving the data URL prefix in the input and getting a decode error.
  • Using Base64url (with - and _) in a standard decoder without converting it.
  • Treating Base64 as a security measure.
  • Encoding an already large file and assuming the result will fit a text field.
  • Dropping padding characters and expecting the decoder to guess.
  • Assuming a decoded file is safe to open just because the decode succeeded.

Troubleshooting

If decoding fails, check the alphabet and the padding. Standard Base64 uses + and /, while the URL-safe variant uses - and _.

If the decoded text looks like mojibake, the source may be binary rather than UTF-8 text. Download the bytes instead.

If a data URL will not decode, split it at the comma and decode only the payload.

If the encoded string is much larger than expected, the file may already be compressed or the paste may include whitespace.

If a round trip does not match, compare the byte length before and after; a truncated paste is the usual cause.

If the encoded output must go into a URL, replace + with -, / with _, and remove the padding; the standard alphabet is not URL-safe.

If a service rejects the string, check whether it expects a line break every 64 or 76 characters; this tool outputs one line.

Related standards and documentation

  • RFC 4648 defines Base64 and its URL-safe variant.
  • Data URLs are described by RFC 2397.
Encoding, not encryption
  • Round-trip to confirm the value.
  • URL-safe uses - and _.
  • Large files belong outside a text field.

Frequently Asked Questions