---
id: "data_uri"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["internet"]
langs: ["common"]
quality: 80
url: "http://registry.apicrafter.io/datatype/data_uri"
---

# Data URI (data: URL) (`data_uri`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

URI of the data: scheme that carries a small file inline instead of pointing to it (RFC 2397): data:, an optional media type with parameters, an optional ;base64 flag, a comma and the data, percent-encoded or in Base64. HTML and CSS use it to embed images and fonts. Without a media type the data is text/plain;charset=US-ASCII. Browsers parse it as the WHATWG Fetch Standard describes, which is more lenient than RFC 2397.

- Parent datatype: `uri`
- Personal data (PII): no
- Categories: Internet (internet)
- Countries: global
- Languages: Common to most languages (common)

## Detection

Regular expression (Python `re`):

```
^data:(?:[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+)?(?:;[A-Za-z0-9!#$&^_.+-]+=[^;,\s]+)*(?:;base64)?,\S*$
```

## Examples

- `data:,A%20brief%20note` — Example of RFC 2397: plain text without a media type
- `data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==` — The text Hello, World! in Base64
- `data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local` — Example of RFC 2397 with a media type
- `data:text/plain;base64` (invalid example) — No comma before the data
- `text/plain;base64,SGVsbG8sIFdvcmxkIQ==` (invalid example) — No data: scheme

## Translations

- ru: Data URI: URI схемы data:, который содержит небольшой файл прямо в адресе, например изображение в Base64 (RFC 2397).

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/Data_URI_scheme>
- doc: <https://www.rfc-editor.org/rfc/rfc2397>
- doc: <https://fetch.spec.whatwg.org/#data-urls>

## Quality

Score 80/100. Missing: mapping (Wikidata, Schema.org, ...), detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/data_uri.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/internet/data_uri.yaml>
