Skip to content
Coverton Blog
In this article
Images

Encode an image as Base64 or a Data URL

Use Base64 when image bytes must be represented in a text-based setting. It encodes the file data as a string; it does not read lettering in the picture, encrypt the content or compress the image.

Open the toolHow to use this tool ↓
Encode images as Base64
This illustration explains the tool's workflow. It is not the processed result of an uploaded file.

How to use this tool

  1. Choose files in JPG, JPEG, PNG, WEBP, GIF, SVG format. Maximum files per batch: 50.
  2. Review Base64 output mode, then start processing.
  3. Download the Base64 (.txt) result and check its content and quality.

Choose the right settings

Choose Data URL for an image address or raw output for a field that wants only Base64. Check whether the destination expects the data: prefix and MIME information as part of the value.

Supported input
  • JPG, JPEG, PNG, WEBP, GIF, SVG
Output
  • Base64 (.txt)
Available settings
  • Base64 output mode

Before you start

Prepare a representative source

Start with a copy of the source and decide where the result will be used. A picture for later editing, an upload with fixed dimensions and a printed page have different requirements. Check the supported input and intended output in this guide; a new filename extension alone does not convert the file.

Where size, quality, background or crop controls are available, change one choice at a time on a representative image. Include small lettering and an important edge in your comparison. If the task extracts information rather than changing the picture, decide which source region and values you need to inspect.

Write down the recipient’s requirements and the choices used for a trial, including output type and any size or background setting that applies. If a detail is already blurred, cropped or absent in the original, changing an output setting will not supply the missing evidence. Compare an intermediate copy separately from the original: it may already contain changes from a previous step. This record helps you decide whether to correct the source, revise one choice or use a different supported operation.

Compare the result with its source

Open the downloaded output in the program that will actually use it. For image outputs, compare the same area at the same zoom, inspect all edges and read the saved dimensions and file size. For extracted text, measurements or color values, check sample entries directly against the visible source; a plausible-looking result can still be wrong.

If the output differs from the preview or cannot be created, check the input format, this tool’s limits and the selected settings before changing the source. Repeating compression or enlarging a small image cannot restore detail already lost. Keep the original so another trial starts from the same evidence.

Example input and output

image.png → Base64 data in TXT

Examples describe the workflow. Results depend on the source file and settings.

Check the saved result before using it

Verify that the string is complete and test image display in the destination setting. For raw output, provide any necessary MIME information according to that system's requirements.

If the result is different from what you expected

Base64 produces a long text representation rather than a smaller image. Large inputs use substantial memory, so review both the image size and the destination's string-length limit.

Limits to keep in mind

  • Saves the image as Base64 code in a TXT file. It does not read or extract the words in the image (OCR).
  • Base64 typically adds about one third to the byte count and does not optimize the image.

Continue with a related tool

Convert JPG to PNG

A PNG copy gives you a file for subsequent editing without adding another round of JPEG compression during this conversion. It stores the pixels decoded from the JPG, including any compression damage already present in the source photo.

Leave both maximum dimensions at 0 to keep the source dimensions. Enter a width or height limit when you need a smaller copy, and the image keeps its aspect ratio within those limits.

Open the tool

Convert PNG to JPG

When a destination accepts JPG only, decide what color should replace the PNG's transparent areas before converting. For graphics containing both photos and text, judge the saved file by its lettering as well as its size.

Choose a background color and JPEG quality, then set maximum dimensions if the destination needs a smaller image. Keep the original PNG alongside the JPG copy when you may need its transparency for future editing.

Open the tool
CovertonEncode images as Base64
Open the tool

This guide explains the public browser tool. Keep a copy of the original and inspect the result before sharing it.