Website review
This review may include AI-generated content and is not individually verified. Domain, certificate and other facts come from the observed data on this page.
What is Base64 encoding?
Base64 encoding is a way of turning binary data into plain ASCII text so it can travel safely through systems that only handle text. It represents every 3 bytes of input as 4 printable characters drawn from a 64-character alphabet (A–Z, a–z, 0–9, +, /), with = used as padding. The result is roughly 33% larger than the original, and it is not encryption — anyone can decode it.
On Encode and Decode Base64, you can paste text and the tool auto-detects whether it looks like Base64 and encodes or decodes accordingly. It also supports drag-and-drop of files and URL shortcuts, so a link like base64.run/hello world encodes that input directly.
Common uses
- Data URIs in web pages: embedding images, fonts, CSS or JavaScript directly in a document, e.g.
data:image/png;base64,.... This cuts external file requests but inflates file size and can bloat HTML. - Email attachments: MIME encodes binary attachments as text so mail servers can carry them.
- APIs and config: sending small binary blobs (keys, certificates, images) inside JSON or XML, which are text-only formats.
- Tokens and identifiers: some auth tokens and IDs are Base64-encoded JSON, though the encoding itself adds no security.
When to use it — and when not to
| Situation | Base64 helps | Better alternative |
|---|---|---|
| Embedding a tiny icon in CSS | Fewer requests, self-contained file | Keep as a file if it's large or cached |
| Sending a file via JSON API | Works with text-only protocols | Multipart upload for big files |
| Storing passwords | Never | Hashing (bcrypt, Argon2) |
| Hiding sensitive data | Never | Encryption |
Quick next step
If you have a string that looks like random letters ending in = or ==, paste it into a Base64 decoder to see the original. If you need to embed a small image in a webpage, encode the file and wrap it in a data: URI using the correct MIME type.
How can I encode or decode Base64 text online?
Paste your text into Encode and Decode Base64 and it will usually do the right thing: the tool auto-detects whether the input already looks Base64-encoded and decodes it, otherwise it encodes it. There are also explicit Encode Base64 and Decode Base64 buttons if you would rather not rely on detection, plus a Copy button for the result. If the input is not valid Base64, it says so instead of guessing.
Common ways to use it
- Quick one-off conversions — paste a token, a snippet of text, or a small file's contents and copy the output.
- Drag and drop — drop a file onto the page to convert it without opening it in another editor.
- Shareable links — the site supports URLs of the form
https://base64.run/hello worldorhttps://base64.run/aGVsbG8gd29ybGQ=, so you can send someone a link that opens with the input already loaded. Encoded URI components are decoded automatically.
Where Base64 actually matters
Base64 represents binary or non-ASCII data using only printable ASCII characters, which makes it safe to move through systems that expect text. The most concrete everyday use is data URIs in web development: instead of linking to an external file, you inline the encoded content directly, e.g. data:image/png;base64,${data}. The site's own notes list the media types you would typically use — image/jpeg, image/png, image/gif, text/javascript, text/css, and font types such as font/opentype;charset=utf-8 and application/font-woff;charset=utf-8.
The trade-off is straightforward: inlining removes a network request and lets a document stand alone, but it makes the file larger (Base64 is roughly a third bigger than the raw bytes) and the encoded content cannot be cached separately the way an external file can. For a small icon or a single CSS rule, inlining is often worth it; for a large image or a shared library, a normal URL is usually the better choice.
A sensible next step
If you are deciding whether to inline an asset, encode it first and compare the resulting size against the original. As a rough rule, inline files under a few kilobytes and keep larger ones as external references. For anything involving secrets, remember that Base64 is an encoding, not encryption — it is trivially reversible, so treat the output exactly as you would the original data.
What is the data URI format and how do I use it to embed images?
A data URI is a way to put a file's contents directly inside a URL instead of pointing to a separate file. For an image, the format is:
data:<media-type>;base64,<base64-encoded-data>
The three parts are:
data:— tells the browser this is inline data, not a normal URL.<media-type>— the image's MIME type, such asimage/png,image/jpegorimage/gif.;base64,— states that the following characters are Base64-encoded.<base64-encoded-data>— the image bytes converted to Base64 text.
A complete example for a small PNG looks like data:image/png;base64,iVBORw0KGgo.... You can paste that whole string into an <img> tag's src, or into CSS as a background-image value.
Embedding an image step by step
- Convert the image file to Base64. You can drag and drop a file onto a converter such as Encode and Decode Base64, which handles files and plain text in one place.
- Copy the resulting Base64 string.
- Combine it with the prefix:
data:image/png;base64,plus the string. Match the media type to the actual file. - Use it where a URL would go:
<img src="data:image/png;base64,iVBORw0KGgo..." alt="Logo"> - Test in a browser. If the image is broken, the usual causes are a wrong or missing media type, a missing
;base64,marker, or truncated Base64 text.
When it helps and when it hurts
| Situation | Data URI | Separate image file |
|---|---|---|
| Tiny icon or logo | Avoids one request; keeps the page self-contained | Extra request for a few bytes |
| Large photo | Base64 inflates size by roughly a third and bloats the HTML or CSS | Better caching and smaller documents |
| Email or offline HTML | Works without external files | Often blocked or missing |
| Frequently reused image | Re-encoded in every document that embeds it | Cached once across pages |
Base64 encoding is not compression: it represents binary data using printable characters, so the encoded text is larger than the original file. That trade-off is why data URIs suit small assets, not photos.
Practical cautions
- Keep embedded images small — icons, spinners, simple logos. For anything substantial, a normal file usually wins.
- Data URIs cannot be cached as separate resources, so the same image embedded in several pages is downloaded repeatedly.
- Some contexts restrict
data:URLs, so check the target environment rather than assuming they always work. - Avoid embedding sensitive images this way if the document may be shared, since the data travels with the file.
If you only need to decode an existing data URI to see the original image, paste the part after the comma into a Base64 decoder and save the result.
Can I drag and drop a file to convert it to Base64?
Yes. On Encode and Decode Base64, dragging a file onto the page converts it, so you do not need to open the file, copy its contents, or paste anything into the input box. The page lists "Drag and Drop" as one of its tips, alongside auto-detection and URL shortcuts.
What to expect
- Drop the file onto the page to convert it. The site describes this as a quick way to convert a file.
- Pasting still works. If your input already looks Base64-encoded, the site decodes it; otherwise it encodes it.
- You can link to a specific input. The site supports URLs such as
https://base64.run/hello worldorhttps://base64.run/aGVsbG8gd29ybGQ=, and says encoded URI components will be decoded.
A practical example
Suppose you are building a small HTML page and want an icon to load without a separate image request. You drag the icon file onto the page, get the Base64 text, and embed it using a data URI in the form data:${mediatype};base64,${data} — for example, with image/png as the media type. The page explains this data URI format and notes it can be used for images, CSS, fonts, and JavaScript.
Before you rely on it
Drag-and-drop conversion is convenient, but check the output yourself for anything important:
- Confirm the result decodes back to the original file, especially for binary files such as images or fonts.
- Remember that Base64 makes data larger than the original file, so embedding many assets can bloat a document.
- For large or sensitive files, consider whether you want the content processed in a browser tool at all.
If you only need a one-off conversion, dragging the file in is the fastest route. If you need to convert many files repeatedly, a command-line tool or build step will usually be more consistent.
How does the auto-detection feature work when I paste text?
When you paste text into Encode and Decode Base64, the tool inspects the input and decides whether it already looks like Base64. If it does, it decodes it; if not, it encodes it. That saves you from choosing a mode manually for the common case of pasting a block of text and wanting the opposite form back.
H3 What "looks like Base64" means in practice
The tool is pattern-matching, not reading your mind. Base64 output normally uses A–Z, a–z, 0–9, +, /, and often ends with = or == padding. A pasted string made only of those characters, in plausible lengths, will usually be treated as encoded data. Ordinary prose contains spaces, punctuation, and lowercase words that fall outside that alphabet, so it gets treated as plain text to encode.
The failure mode is a short, ambiguous string. A word like "hello" is valid Base64 alphabet-wise, so it may be decoded rather than encoded. If the result looks wrong, switch to the explicit Encode or Decode option instead of relying on detection.
H3 A concrete scenario
Suppose you are embedding a small icon directly in a stylesheet as a data URI. You paste the raw image data and the tool encodes it. Later, a colleague sends you a long data:image/png;base64,... string and you paste it back to recover the original bytes — auto-detection handles that direction without extra clicks.
H3 When to override it
- Pasted text is short or all letters and digits: choose the mode yourself.
- You need a guaranteed direction for a script or repeated task: use the explicit buttons.
- The input is a URL-encoded value: the site notes that encoded URI components are decoded, which is useful when copying from query strings.
If auto-detection gives an unexpected result, the fastest check is to press the opposite button and compare. For a second opinion on a specific string, Base64 Decode and Encode offers a straightforward manual alternative.
Can I create a link that automatically encodes or decodes specific text?
Yes. base64.run supports URL shortcuts: appending the text or the Base64 string directly to the site's address tells the tool what to convert. If the text looks like valid Base64, it decodes it; otherwise it encodes it. Encoded URI components are decoded first, so you can paste a value that has already been percent-encoded.
A few practical notes:
- Text to encode: link to
base64.run/hello worldand the tool treats the input as plain text. - Base64 to decode: link to
base64.run/aGVsbG8gd29ybGQ=and it recognizes the Base64 pattern and decodes it. - Percent-encoded input: if your string contains spaces, slashes, or symbols, they may arrive URL-encoded; the tool decodes those URI components before processing.
- Ambiguity risk: a short string that happens to be valid Base64 (for example, a word made only of Base64 characters with the right length) may be decoded when you meant to encode it. For short or ambiguous inputs, check the result rather than assuming.
Next step: build the link by pasting your input after the domain, then test it in a private window. If the output is the opposite of what you intended, switch to the explicit Encode or Decode option instead of relying on auto-detection.
When to use this: it is handy for sharing a single conversion with a colleague, embedding a ready-made link in notes, or bookmarking a recurring string. For files, drag-and-drop is the better route since it avoids stuffing large payloads into a URL. For repeatable or automated conversions, a command-line tool such as base64 on macOS/Linux or PowerShell's [Convert]::ToBase64String is more reliable than a link.
User reviews (0)