What is a Data URL?
4 November 2022 (Updated 4 November 2022)
In a nutshell
A Data URL is a URL prefixed with the data:
schema that lets you embed small files inline. It has the following syntax:
data:[<mediatype>][;base64-token],<data>
mediatype
: A MIME type (e.g.,image/png
). Defaults totext/plain;charset-US-ASCII
base64-token
: Needed for non-textual datadata
: The base64 encoded string
Reserved characters, spaces, newline characters, and other non-printing characters must be percent-encoded.
Examples
Plain text
data:,Hello%2C%20World%21
Base 64 encoded version of text
data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==
HTML document
data:text/html,%3Ch1%3EHello%2C%20World%21%3C%2Fh1%3E
Sources
Tagged:
HTTP
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment