About Image to Base64
Convert an image to Base64 when you want it inside your code instead of as a separate file: a small icon in a CSS file, a logo in an HTML email template, an image in a single-file demo, or a picture in a JSON payload for an API. Pick one or several images and the encoded text appears right away.
Switch Copy as between Data URI, plain Base64, a CSS background-image rule, a ready img tag or Markdown, then copy with one click. Base64 text is about a third larger than the file, and the page shows both sizes, so it's best for small images. Everything is done by your browser, nothing is uploaded, and each image can be up to 20 MB.
How to use Image to Base64
- 1Choose your images
Click Choose images or drop the files you want to turn from image to Base64. PNG, JPG, WebP, GIF, SVG and ICO all work.
- 2Pick the output format
Under Copy as, choose Data URI, Base64, CSS, img or Markdown.
- 3Copy the code
Click Copy next to an image and paste the text into your HTML, CSS or JSON.
Why use Cubfile for this
- Five output styles
Data URI, raw Base64, a CSS background, an HTML img tag and a Markdown image.
- Size shown up front
Each file shows its original size next to the encoded size.
- Several images at once
Encode a whole icon set in one go, each with its own copy button.
- Never uploaded
Encoding happens in your browser and doesn't use any daily tasks.