Home › Developer Tools › Base64 to Image

Base64 to Image

Paste a Base64 string or a full data URI and see the image right away. The tool detects the real file type from its bytes, shows the size and dimensions, and lets you download it with the right extension.

Last updated:

0 characters
Preview
Your image will appear here
Format
-
Dimensions
-
File size
-
MIME type
-
Advertisement
Advertisement

How to use the Base64 to Image

  1. Paste your Base64 into the box. A full data URI (data:image/png;base64,…), raw Base64, or even a whole <img> tag or CSS url() works.
  2. Check the preview. The detected type, dimensions and size appear next to it, with a warning if something looks wrong.
  3. Change the background to checkerboard, white or dark to inspect transparent images.
  4. Download the image in its original format, or click Download as PNG to convert it.
  5. Copy the data URI if you need a clean, normalized version of the string.

Recognizing image types in Base64

Every file format starts with a fixed signature ("magic bytes"). Because Base64 encodes 3 bytes into 4 characters, the same signature always produces the same first characters, so you can often tell the format at a glance. This tool checks the decoded bytes, which is more reliable than trusting the data: prefix.

FormatFirst bytes (hex)Base64 starts withMIME type
PNG89 50 4E 47 0D 0A 1A 0AiVBORw0KGgoimage/png
JPEGFF D8 FF/9j/image/jpeg
GIF47 49 46 38 ("GIF8")R0lGODimage/gif
WebP52 49 46 46 … 57 45 42 50 ("RIFF…WEBP")UklGRimage/webp
SVGtext starting with <svg or <?xmlPHN2Zy or PD94bWwimage/svg+xml
BMP42 4D ("BM")Qkimage/bmp
ICO00 00 01 00AAABAAimage/x-icon
AVIF / HEIC… 66 74 79 70 ("ftyp") at byte 4usually AAAAimage/avif, image/heic
PDF (not an image)25 50 44 46 2D ("%PDF-")JVBERi0application/pdf

Fixing a Base64 string that will not decode

  • Remove wrappers. Quotes, url(…), src="…" and JSON escapes such as \n or \/ are not part of Base64. This tool strips them automatically.
  • Check the length. Valid Base64 has a length that is a multiple of 4 once padding is added. A remainder of 1 means characters are missing, usually because the string was cut off when copying from a log or a database column with a size limit.
  • Look for double encoding. If the decoded data is itself Base64 text (for example it starts with ZGF0YTpp, which is "data:i" encoded again), it was encoded twice. The tool detects this and decodes both layers.
  • URL-safe strings from JWTs or URLs use - and _ instead of + and /, and often drop the = padding. Both are converted for you.

Frequently asked questions

How do I convert Base64 to an image?

Paste the Base64 text into the box. The tool decodes it to bytes in your browser, identifies the image format from the first bytes of the file and shows it. Click Download to save it as a .png, .jpg, .gif, .webp or .svg file.

Do I need the data:image/png;base64, prefix?

No. Raw Base64 works too: the tool reads the file signature to work out the format. If you paste a data URI, the prefix is checked against the actual data and you are warned if they disagree.

Why does my Base64 string not show an image?

Common causes are a truncated string (copied only part of it), extra characters such as quotes or escaped \n sequences, a string that encodes something other than an image (for example a PDF or text), or data that was encoded twice. The tool tells you which of these it detects.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / so it can appear in URLs, often without = padding. This tool accepts both alphabets and adds missing padding automatically.

Is it safe to paste private images here?

Yes. The string is decoded locally with JavaScript and is never sent to a server. SVG images are shown inside an img element, which does not run scripts.

How can I tell what file type Base64 contains?

Every file format starts with a signature. In Base64, PNG begins with iVBORw0KGgo, JPEG with /9j/, GIF with R0lGOD, WebP with UklGR and PDF with JVBERi0. The tool checks the decoded bytes for these signatures.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.Image Metadata ViewerSee a photo's EXIF data: camera, lens, exposure, date and GPS location, then strip it in one click.SVG to PNGConvert SVG graphics to PNG or JPEG at any scale.Paste Image to FilePaste a clipboard image with Ctrl+V and save it as PNG, JPG or WebP, or copy images to the clipboard.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.Query String to JSONConvert URL query strings to JSON with nested brackets and arrays, and JSON back to a query string.REM to PX ConverterConvert CSS rem values to pixels for any root font size, with a quick 0.25–6rem table.SQL to JSON ConverterConvert SQL INSERT statements and dumps into a JSON array of row objects, with CSV export.TSV to CSV ConverterConvert TSV to CSV and back, or between tab, comma, semicolon and pipe, with correct quoting.TypeScript to JavaScriptConvert TypeScript or TSX to clean JavaScript instantly: strip types, keep or compile JSX.XML to YAML ConverterConvert XML to clean YAML with attributes, text nodes, lists and exact error lines.YAML to XML ConverterConvert YAML to pretty, well-formed XML with custom root, attributes and array item tags.Boolean Algebra SimplifierSimplify boolean expressions or minterm lists to minimal SOP and POS with Quine-McCluskey steps.Compare Excel FilesCompare two Excel spreadsheets cell by cell, highlight changes and export a diff report.CSV CleanerClean messy CSV in one click: trim spaces, drop empty rows and columns, fix headers, dedupe.CSV VLOOKUP ToolJoin two CSV or Excel files on a key column like VLOOKUP, with left, inner and full joins.Remove Duplicates in ExcelFind and remove or highlight duplicate rows in XLSX or CSV files by the columns you choose.GeoJSON ViewerView GeoJSON on a map, inspect and edit properties, validate against RFC 7946 and export.GPX ViewerOpen GPX tracks on a map with distance, elevation profile, moving time, speed and splits.JSON Repair ToolFix broken JSON automatically: trailing commas, quotes, comments, truncated data, with a diff.Karnaugh Map SolverSolve 2–6 variable K-maps: click cells or enter minterms to get the minimal SOP or POS with groups.Merge Excel FilesCombine XLSX, XLS and CSV files into one workbook or append all rows into a single sheet.Parquet File ViewerOpen Apache Parquet files in your browser: schema, rows, filters and CSV or JSON export.Query CSV with SQLRun SQL on CSV, Excel, JSON and Parquet files in your browser with DuckDB. Join and export.Online Serial MonitorTalk to Arduino, ESP32 and USB serial devices in your browser: log, send, plot and save.Split Excel FileSplit an Excel sheet into several files by row count or by each value in a column, as ZIP.SQL Create Table GeneratorDefine columns, keys, defaults and indexes; get CREATE TABLE SQL for MySQL, Postgres and more.SQL IN Clause GeneratorTurn a pasted list into a SQL IN ('a','b') clause with quoting, dedupe and 1,000-item chunks.SQL Online CompilerRun SQL queries online on SQLite with sample databases, a result grid, CSV export and .db save.SQL to ER DiagramPaste CREATE TABLE statements and get an entity-relationship diagram with keys and links.XML to XSD GeneratorGenerate an XML Schema (XSD) from sample XML: types, occurrences, attributes and namespaces.XML ValidatorCheck if XML is well-formed, see the exact line and column of each error and pretty-print it.Wildcard Mask CalculatorConvert a subnet mask or CIDR to a wildcard mask for ACLs and OSPF, with range and binary.CSV to VCF ConverterConvert a contacts CSV into a vCard (.vcf) file, mapping columns to name, phone, email and more.CSV to YAML ConverterConvert CSV rows to a YAML list of mappings with type inference and delimiter detection.
See all 129 Data & File Format Converters →