ASCII to Data URI Converter
Convert ASCII text to a data URI (data:text/plain;base64,...) online. Supports multiple MIME types and encoding options.
Paste your ASCII text, pick a MIME type, and you get a data: URI ready to drop into HTML, CSS, or JS — no separate file, no extra HTTP request. Base64 is the safe default; percent-encoding often comes out smaller for plain text. And everything runs in your browser. Nothing gets uploaded.
How to Use
Enter your ASCII text in the left panel. You can type, paste, or load a sample.
Select MIME type from the dropdown (text/plain, text/html, text/css, application/json, or application/javascript).
Choose encoding -- Base64 for compact output, or Percent-encoded for readable URIs.
Click Convert or enable Live mode to generate the data URI automatically as you type. Copy, download, or preview the result.
Frequently Asked Questions
What is a data URI?
A data URI (also called a data URL) is a scheme that allows you to embed small files directly inline in HTML, CSS, or JavaScript using the format data:[mediatype][;base64],data. Instead of referencing an external file via a URL, the content is encoded and included right in the source code. This eliminates an extra HTTP request and is especially useful for small assets like icons, fonts, or configuration snippets.
What is the difference between base64 and percent-encoded data URIs?
Base64 encoding converts binary data into an ASCII string using 64 characters (A-Z, a-z, 0-9, +, /). It increases size by about 33% but is safe for all content types. Percent-encoding (also called URL encoding) replaces unsafe characters with %XX hex codes while leaving safe ASCII characters as-is. For plain ASCII text, percent-encoding can produce smaller output since letters and digits pass through unchanged, but base64 is more universally compatible.
What MIME types can I use with data URIs?
You can use any valid MIME type with a data URI. Common choices include text/plain for raw text, text/html for HTML snippets, text/css for inline stylesheets, application/json for JSON data, and application/javascript for JS code. The MIME type tells the browser how to interpret the embedded data. If omitted, it defaults to text/plain;charset=US-ASCII.
Are there size limits for data URIs?
While the data URI specification does not define a maximum length, browsers impose practical limits. Most modern browsers support data URIs up to at least 2 MB, but some older browsers limit them to 32 KB or 64 KB. For best compatibility, keep data URIs under 32 KB. Very large data URIs can also slow down page parsing and increase memory usage compared to external files.
Is my data safe when using this tool?
Yes. This tool runs entirely in your browser using client-side JavaScript. Your text is never sent to any server. The conversion happens locally on your device, so your data remains completely private. You can verify this by checking the network tab in your browser's developer tools -- no data is transmitted when you convert.