File to Data URI Converter

File to Data URI Converter

Local Processing

Convert uploaded files into base64-encoded Data URIs for inline embedding in HTML or CSS.

How It Works & Processing Standards

Convert uploaded files into base64-encoded Data URIs for inline embedding in HTML or CSS.

Tool processing runs in your browser. If you create a calculator or conversion share link, its values are included in the URL. See the privacy policy for account, analytics and advertising data.

Current Limits

  • Maximum input length: 100,000 characters

Choose file → Data URI or text → Data URI under "Task". For text such as SVG, percent-encoding instead of Base64 can make it shorter.

Base64 is about 33% larger than the original. Keep large images as files.

What You Can Do

File → Data URI
Encodes the chosen file as Base64 with its MIME type.
Text → Data URI
Encodes text as Base64 or percent-encoding.

How to Use File to Data URI Converter

  1. 1
    Choose a taskFile or text.
  2. 2
    Enter inputPick a file, or type text and a MIME type.
  3. 3
    CopyPaste the Data URI into CSS or HTML.

Examples

Text, Base64
Input: Hello, text/plain
Result: data:text/plain;base64,SGVsbG8=
SVG, percent-encoded
Input: <svg/>, image/svg+xml, Base64 off
Result: data:image/svg+xml,%3Csvg%2F%3E

Common Use Cases

  • Embedding small icons in a CSS background
  • Putting images into email HTML

Frequently Asked Questions (FAQ)

For SVG, Base64 or percent-encoding?

SVG is text, so percent-encoding (Base64 off) is usually shorter and compresses better with gzip.

Have feedback or ideas for this tool? Suggest & Inquire →