Image & design · Practical guide

Convert an image to Base64 for HTML, CSS and APIs

Prepare a small image, encode its exact file bytes, and choose the output that matches where you will use it.

1. Prepare a suitably small asset when needed

Base64 usually adds about one third to the file size, so resize or compress large images before encoding when visual changes are acceptable. Skip this step when the receiving system must get the exact original file bytes.

Open Image resizer ↗

2. Encode the original file bytes

Choose, drop or paste a PNG, JPEG, WebP, GIF or AVIF. The converter reads the file directly and does not draw it to a canvas, recompress it or remove metadata. Review the filename, MIME type, dimensions and output size before copying.

Open Image to Base64 ↗

3. Choose Base64 or a complete Data URL

Use Base64 only when an API field already supplies the MIME type. Use a full data: URL for a small inline HTML image or CSS url() value. Base64 is encoding, not encryption, so do not use it to hide confidential images.

Open Image to Base64 ↗
Tool links open a fresh workspace. Inputs are not transferred between pages. For supported text operations, the private workbench offers explicit transfers in memory.

Related guides

Turn a colour idea into readable text ↗

Find your next tool

JSON formatterCode & dataCSV ↔ JSONCode & dataSQL formatterCode & dataBase64 encoder / decoderText & encodingURL encoder / decoderText & encodingHTML entity converterText & encodingText difference checkerText & encodingWord & character counterText & encodingText case converterText & encodingUUID generatorCode & dataUnix timestamp converterTime & numbersPercentage calculatorTime & numbersXML formatter & validatorCode & dataHTML formatterCode & dataCSS formatter & minifierCode & dataJavaScript formatterCode & dataRegular expression testerCode & dataSHA hash generatorCode & dataNumber base converterTime & numbersData-size converterTime & numbersUnit converterTime & numbersDate difference calculatorTime & numbersTime-zone converterTime & numbersLine toolsText & encodingImage to Base64Image & designImage resizerImage & designImage compressorImage & designImage format converterImage & designFavicon generatorImage & designColour converter & pickerImage & designColour contrast checkerImage & designQR-code generatorImage & designDiscount calculatorTime & numbers

Tab or arrow keys to explore · Enter to open · Esc to close