What a data URI actually is
A data URI carries the file itself in place of an address. The data:image/png;base64, prefix names the media type and the encoding, and everything after the comma is the file's bytes written in Base64 — an alphabet of 64 characters that survives being pasted into a stylesheet, a JSON payload or an HTML attribute without being mangled.
That last point is the whole reason the encoding exists. Raw image bytes include values that terminate strings, break out of quotes, or get rewritten by anything that assumes text. Base64 trades about a third more size for the guarantee that the data passes through text-only channels unchanged.
Using the output
In CSS, put it straight in a url(). In HTML, it is the src of an <img>. In JSON it is just a string. To go the other way, or to encode text rather than a file, use the Base64 encoder and decoder. If the image is larger than you expected, compress it first — the encoding multiplies whatever you start with.