File to Base64 and data URLs

Turn a file into Base64 text or a data URL for code and emails, or turn Base64 back into the file.

FluffyShield Protected workspace
From
To

Convert to

Common

File Any file Download the bytes
Base64 Text for code and emails
Data URL data:…;base64,…

Your file or text stays when you change the direction.

FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Turn a file into Base64 or a data URL—and back

Need a file as text for a page or app? FluffyBench makes Base64 or a data URL in your browser—and turns either back into a downloadable file.

How it works
  1. Match your destination’s format
  2. Choose a file or paste encoded text
  3. Check the result, then copy or download

Choose Base64 or a data URL for your destination

Match the format your destination asks for. Think of Base64 as a parcel’s contents written as text; a data URL adds the shipping label in front.

A real sunset PNG becomes Base64 text or a data URL: 242 file bytes, 324 Base64 characters, or 346 data URL characters. The same payload appears in both text formats.
  1. Start with the file

    Encoding changes how the bytes are written. It doesn’t compress the image.

  2. Base64: the contents

    Choose Base64 when the receiving field asks for Base64 text by itself.

  3. Data URL: label + contents

    data: starts the URL; image/png names the claimed type; ;base64 identifies the encoding. The comma starts the payload.

The same PNG in two text formats; the label adds characters, and the payload is abbreviated here. How we reviewed

For a small icon embedded in a web page, a data URL can carry the image inside the page’s code. Neither choice changes the image’s file format.

If Base64 itself is new to you, FluffyBench’s Base64 guide explains how bytes become text.

Make Base64 or a data URL in FluffyBench

Here’s the file-to-text path in FluffyBench’s File Base64 tool, including both output choices. Choosing a file starts encoding, so there’s no Convert button to press.

  1. Keep From set to File. Open To to choose the text your destination asks for.
    Keep From set to File. Open To to choose the text your destination asks for.
    Step 1. Keep From set to File. Open To to choose the text your destination asks for.
    1. From File means you’re starting with a local file.
    2. Open To to choose your output.
  2. Choose Data URL for a labeled string, or Base64 for the payload by itself. Choosing an option closes the picker.
    Choose Data URL for a labeled string, or Base64 for the payload by itself. Choosing an option closes the picker.
    Step 2. Choose Data URL for a labeled string, or Base64 for the payload by itself. Choosing an option closes the picker.
    1. Data URL adds the type label and comma.
    2. Base64 gives you the file’s bytes as text.
  3. Choose file starts encoding in your browser.
    Choose file starts encoding in your browser.
    Step 3. Choose file starts encoding in your browser.
    1. Choose file opens your device’s file picker.
  4. Check the character count against your destination’s limit. Copy takes the complete string; Download .txt saves that same text.
    Check the character count against your destination’s limit. Copy takes the complete string; Download .txt saves that same text.
    Step 4. Check the character count against your destination’s limit. Copy takes the complete string; Download .txt saves that same text.
    1. Check the output’s character count.
    2. Copy puts the complete text on your clipboard.
    3. Download .txt saves the encoded text.

The Base64 part is about a third bigger than the file, and the full data URL is a little larger again because of its data:…;base64, prefix.

Copying the complete string shares the file’s contents. Encoding isn’t encryption, so don’t treat the text as a secret version of your file.

Turn Base64 or a data URL back into a file in FluffyBench

FluffyBench’s File Base64 tool also recovers files from pasted text. From identifies the text you have; To is File for either decoding choice.

  1. Open From to choose the kind of text you have.
    Open From to choose the kind of text you have.
    Step 1. Open From to choose the kind of text you have.
    1. Open From to switch from a file to text.
  2. Choose Data URL for text starting with data:, or Base64 for a payload without that label. To becomes File.
    Choose Data URL for text starting with data:, or Base64 for a payload without that label. To becomes File.
    Step 2. Choose Data URL for text starting with data:, or Base64 for a payload without that label. To becomes File.
    1. Choose Data URL for a complete data: string.
    2. Choose Base64 for plain Base64 text.
  3. Paste the complete data URL into Base64 or data URL to decode. FluffyBench decodes as you paste.
    Paste the complete data URL into Base64 or data URL to decode. FluffyBench decodes as you paste.
    Step 3. Paste the complete data URL into Base64 or data URL to decode. FluffyBench decodes as you paste.
    1. Paste your complete string here.
  4. The file card shows the recovered byte count and claimed type, with Download decoded-file.bin to save the recovered bytes.
    The file card shows the recovered byte count and claimed type, with Download decoded-file.bin to save the recovered bytes.
    Step 4. Check the recovered byte count and claimed type. Download decoded-file.bin saves the recovered bytes; its .bin name doesn't identify or convert the contents.
    1. Check the recovered file’s byte count.
    2. This is the type claimed by the text.
    3. Download decoded-file.bin saves the file.

For an image from a trusted source, compare the download with the original in the app where you'll use it.

The original sunset PNG and recovered PNG side by side, with the same appearance and byte count.
  1. Original PNG

    The local image before encoding.

  2. Recovered PNG

    The downloaded bytes reproduce the original image.

  3. Same file size

    Decoding recovers the file's bytes, without the text label or encoding.

This recovered PNG matches the original. The PNGs come from the original file and its downloaded bytes.

“Type the text claims” is a label supplied by the text, not a check of the bytes inside. FluffyBench doesn’t render, fetch or run the decoded contents. A downloaded file can still contain active content when opened elsewhere; decoding doesn’t make an untrusted file safe.

When pasted text won’t decode

A missing comma or incomplete Base64 ending can stop decoding. These syntax examples show the correction beside FluffyBench’s actual refusal message.

Missing and restored data URL comma; incomplete YQ and complete YQ==; accepted standard + / and rejected URL-safe - _.
  1. A comma before the payload

    The comma separates the data URL’s label from its contents.

  2. Complete standard Base64

    Keep the complete ending, including any = padding. Plain Base64 can contain spaces and line breaks between groups.

  3. Check the alphabet

    FluffyBench accepts standard Base64. URL-safe Base64 uses different characters.

Syntax examples rendered for illustration, with real UI crops. An HTTP link or file path isn’t a data URL; FluffyBench won’t fetch it.

Why FluffyBench pauses before reading a large file

FluffyBench pauses before reading a large selected file when its estimated working memory reaches the warning threshold. The text and browser buffers can need much more space than the file itself.

This is a big one: estimated text length and memory, with Encode anyway and Choose another file.
  1. Read the estimate

    The estimate helps you decide whether to continue; it isn’t measured memory use or a file-size cap.

  2. Encode anyway

    Continue reading and encoding the selected file.

  3. Choose another file

    Open the file picker to select a smaller file instead.

Encoding is paused at this warning; no large-file output is shown.

Related FluffyBench tools for other kinds of text

Escaping text or inspecting a web address differs from carrying a file’s bytes inside text.

Search FluffyBench