Data URI Generator
Turn any file (image, SVG, font, PDF, audio) or an SVG snippet into a data URI to embed straight into HTML or CSS. Base64, or shorter URL encoding for SVG.
How to create a data URI
- Choose, drop or paste a file (up to 5 MB). For an SVG snippet or text, choose "Text" and paste it in.
- Check the file type (MIME) and the encoding: Base64 works for any file, URL encoding for SVG and text (usually shorter).
- Pick the form you need: data URI, CSS, img tag, favicon or download link, then copy it.
Frequently asked questions
Embedding a small file (an icon, an SVG logo, a font) straight into HTML or CSS, so the page needs no separate download. Best for files of a few KB; large ones make the page heavy and cannot be cached.
For SVG and text, URL encoding is usually shorter than Base64 and stays readable. PNG, JPG, fonts and other files can only use Base64.
Base64 turns every 3 bytes into 4 characters, so it is about 33% longer. The size before and after is shown with the result.
Image to Base64 is for images. This tool takes any file and also pasted SVG or text, lets you change the file type, and has ready code for CSS, favicons and download links.
It is completely free and needs no sign-up.
Related tools
Data URI DecoderView and save files from a data URI or Base64Image to Base64Embed images in HTML or CSS with Base64MIME Type LookupLook up MIME types and check a file's real typeSlug generatorTurn titles into clean URL slugsUUID generatorGenerate random UUID identifiersColor converterConvert between HEX, RGB and HSL color codesRegex testerTest a regex: highlighted matches, groups and replaceRegex generatorReady-made regex for email, phone, dates and moreRegex explainerUnderstand every part of a regex