How to Encode or Decode Base64 on base64.run

Updated

Paste your text into the input box and base64.run will handle the rest: if the input already looks like Base64, it decodes it; otherwise it encodes it. You can also drag and drop a file onto the page, or put the content directly in the URL path (for example https://base64.run/hello world) to convert it. The tool shows "Not valid Base64 :(" when you try to decode something that isn't valid Base64.

Encoding or decoding pasted text

  1. Open base64.run.
  2. Paste your text into the input area.
  3. Let auto-detection run. If the input looks like it's already Base64-encoded, the tool decodes it; if not, it encodes it.
  4. Copy the result using the Copy control.

The key behavior here is auto-detection. You don't pick "encode" or "decode" first — the tool infers the direction from the input itself. That means the same paste action can produce opposite results depending on what you paste.

If you want to force a direction instead of relying on detection, the page exposes Encode Base64 and Decode Base64 controls alongside Auto Detect.

Converting a file by drag and drop

Drag a file onto the page to convert it quickly. This is the fastest path when your source isn't text you can copy — for example, an image, font, or stylesheet you want as a Base64 string.

The output is the Base64-encoded contents of that file, which is what you'd embed in a data URI.

Using URL shortcuts

You can link directly to a conversion by putting the content in the URL path:

  • https://base64.run/hello world — encodes the text
  • https://base64.run/aGVsbG8gd29ybGQ= — decodes the Base64

Encoded URI components in the URL are decoded first, so you can pass content that contains characters needing escaping.

This is useful when you want a reusable link that always performs the same conversion, rather than pasting each time.

What happens with invalid Base64

If you paste something that isn't valid Base64 and the tool tries to decode it, you'll see Not valid Base64 :(. Check for:

  • Characters outside the Base64 alphabet
  • Incorrect padding (Base64 uses = padding)
  • Truncated or partially copied strings

If you only need to encode, this message won't appear — encoding accepts arbitrary text.

When to use Base64 at all

Base64 represents binary or text data as ASCII characters, so it can travel through systems that expect text. A common use is embedding assets directly in a document with a data URI:

data:${mediatype};base64,${data}

Here ${mediatype} is the MIME type (such as image/png, image/jpeg, text/css, or font/opentype;charset=utf-8), ;base64, marks the encoding, and ${data} is the Base64 content.

This helps when you want to remove dependencies on external files, cut the number of network requests, or make a document self-contained. The trade-off is that Base64 inflates size, so it isn't always the right choice for large assets.

Quick reference

Task How
Encode or decode pasted text Paste and let auto-detection decide
Force a direction Use Encode Base64 / Decode Base64
Convert a file Drag and drop it onto the page
Share a fixed conversion Use a URL like base64.run/hello world
Diagnose a failure Look for invalid characters or bad padding