Base64 Image
Preview a base64 image and turn it back into a data URI, or drop in an image file to encode it. Detects PNG, JPEG, GIF, WebP and BMP from the bytes themselves.
base64 or data uri0 ln / 0 ch
data uri
ready
local / nothing uploadedAbout this tool
A data URI embeds an image directly in HTML or CSS as base64 text, which removes a network request for small icons and placeholder images. This tool converts both directions and detects the image format from the file signature rather than trusting a label.
How to use it
- Paste base64 image data, with or without the data: prefix.
- The format is sniffed from the bytes and the image previewed.
- Copy the normalised data URI.
- To go the other way, choose a file and copy the generated data URI.
Examples
A 1x1 PNG
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
data:image/png;base64,...
Limits and notes
- Base64 is about 33 percent larger than the binary file, so this suits small images only.
- Huge images can be slow to render because the whole string must be parsed.
Frequently asked questions
- Which formats are detected?
- PNG, JPEG, GIF, WebP, BMP and ICO, identified by magic bytes at the start of the data.
- Why does my string fail to decode?
- Most often the padding is missing or the string was truncated when copied. Base64 length must be a multiple of four.
- Should I inline all my images?
- No. Data URIs cannot be cached separately and block the stylesheet. Inline small icons, keep photographs as files.
Want the details? Read the full guide: Inlining an Image Without Slowing the Page.
Related Tools
SVG OptimizerStrip comments, metadata and editor namespaces from an SVG and collapse redundant whitespace. Shows exactly how many bytes were saved.
JSON ValidatorValidate JSON syntax with detailed error messages. Catch trailing commas, missing brackets, and syntax errors instantly before sending payloads to your API.
JSON FormatterBeautify, validate, minify, and view JSON. Format messy API responses into readable code or compress it to save bandwidth, running safely in your browser.
JSON MinifierCompress JSON to a single line. Remove all unnecessary whitespace and line breaks to reduce payload size for production APIs without altering the underlying data.
JSON ViewerView JSON in an interactive, collapsible tree structure. Easily navigate massive API responses, expand specific nodes, and inspect deeply nested objects or arrays.
XML FormatterFormat and validate XML documents. Add proper indentation, catch malformed tags, and minify XML markup for optimized data transfer in SOAP APIs or RSS feeds.
HTML FormatterBeautify HTML markup. Apply consistent indentation and line breaks to unreadable or minified HTML, making it easier to review, debug, and maintain web pages.
CSS FormatterBeautify CSS stylesheets. Organize selectors, properties, and media queries with standard indentation, transforming compressed production CSS into readable code.