Skip to content
uencoder
TASK

Encode a file into a Data URI for inline embedding

Convert a small image, font, or file into a data: URI so it can be embedded directly in HTML, CSS, or Markdown without a separate HTTP request.

  1. 1

    A Data URI (data:[<mime>][;base64],<data>) embeds file contents directly in a URL. Browsers render it inline without a network request — useful for small icons, fonts, and sprites in HTML/CSS.

  2. 2
    Base64 Encoder →

    Upload or paste the file bytes. The tool outputs the Base64 string with no line breaks.

  3. 3
    Base64 Image Preview →

    If the file is an image, preview it here to confirm the Base64 renders correctly before embedding.

  4. 4
    MIME Types Reference →

    Look up the correct MIME type for your file (e.g. image/png, font/woff2, text/css) to prefix the data URI.

  5. 5

    Assemble the URI: data:<mime>;base64,<base64>. Paste it into <img src="..."> or url("...") in CSS. Keep Data URIs under ~32 KiB — larger ones hurt parse performance and some browsers impose limits.

Frequently asked questions

When should I use a Data URI vs a regular file?
Use Data URIs for small, infrequently-changed assets (icons, tiny sprites) where eliminating an HTTP request outweighs the ~33% size overhead of Base64. For large files or frequently-changed assets, serve them as separate files with cache headers.
Why does my Data URI not render?
Common causes: missing or wrong MIME type, missing ;base64 flag for binary data, or line breaks in the Base64 string. The Base64 must be a single unbroken line.

Workflows that solve this

Convert Ascii85 to Base64
Decode Ascii85 and re-encode as Base64 for wider compatibility.
PIPELINE
Convert Base2048 to Base64
Decode Base2048 (emoji) and re-encode as Base64 for standard transport.
PIPELINE
Convert Base32 to Base64
Decode a Base32-encoded string into raw bytes and re-encode as Base64 for more compact representation.
PIPELINE
Convert Base58 to Base64
Decode Base58 and re-encode as Base64 for standard compatibility.
PIPELINE
Base64 encode then decode round-trip
Encode text to Base64 and decode it back to verify the round-trip preserves the original data.
PIPELINE
Blowfish Encrypt then Base64
Blowfish encrypt then Base64-encode for text-safe transport.
PIPELINE
DES Encrypt then Base64
DES encrypt then Base64-encode for legacy compatibility.
PIPELINE
Encode a JSON payload for URL transport
Prepare a JSON document for a URL parameter: pretty-print, Base64-encode, then percent-encode — the exact inverse of the nested-parameter decode chain.
PIPELINE
AES encrypt then Base64 encode
Encrypt plaintext with AES and encode the ciphertext as Base64 for text-safe transport.
PIPELINE
Hash content and encode as Base64
Compute a hash of the input and encode the hash digest as Base64 for compact transport.
PIPELINE
Convert Hex to Base64
Decode a hexadecimal string into raw bytes and re-encode it as Base64 for compact transport.
PIPELINE
HMAC Sign then Base64 Encode
Generate HMAC signature then Base64-encode for API auth headers.
PIPELINE
Morse Encode and Base64 Transport
Encode text as Morse code then Base64-encode for digital transport.
PIPELINE
RC4 Encrypt then Base64
RC4 encrypt then Base64-encode for transport.
PIPELINE
RIPEMD-160 Hash then Base64
Compute RIPEMD-160 hash then Base64-encode for transport.
PIPELINE
Shuffle Text and Base64 Encode
Shuffle text characters then Base64-encode the result.
PIPELINE
Unicode Escape and Base64 Encode
Unicode-escape text then Base64-encode for ASCII-safe transport.
PIPELINE
URL Encode then Base64 Double Encode
URL-encode then Base64-encode for double encoding in API payloads.
PIPELINE
UUencode then Base64
UUencode text then Base64-encode the result for double encoding.
PIPELINE
Generate UUID and Base64 Encode
Generate a UUID then Base64-encode it for compact storage.
PIPELINE

Learn more

Want to understand why?

Related tools