🔒 Runs in your browser — nothing is uploaded✓ Free, no signup
Image to Base64 Converter
Drop, choose or paste an image to get its Base64 data URI — ready to use in CSS, HTML, JSON or Markdown. Your image never leaves your device.
The image is read on your device. It is never uploaded.
Base64 output
Choose an image to see its Base64 code.
When should you use the Image to Base64?
- Embedding a small icon or logo directly in CSS
- Adding images to HTML emails without hosting them
- Putting an image into JSON or an API request body
How to use the Image to Base64
- 1
Add an image
Drag it onto the box, click to choose a file, or paste with Ctrl/⌘ V.
- 2
Check the size
See the original size and the Base64 size. Images over 100 KB get a warning.
- 3
Pick a format
Choose the data URI, plain Base64, a CSS rule, an <img> tag or Markdown.
- 4
Copy
Click Copy next to the format you need.
Examples
A small PNG icon
Input
icon.png (1.2 KB, 32 × 32)
Output
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…
background-image: url("data:image/png;base64,…");Common errors and how to fix them
The Base64 string is enormous- Base64 adds about 33% to the file size. Compress or resize the image first with the Image Compressor, or serve large images as normal files.
Pasting doesn't work- Some browsers only paste images copied as images (not as files from a folder). Use drag and drop or the file picker instead.
Explore More Developer Tools
Format, Validate, and Generate Data Instantly
TrueFormatter provides essential utilities for modern web development, including JSON formatting, YAML conversion, and more.
JSON Auto-Fixer & Formatter
Repair, validate, and beautify broken JSON (missing quotes, trailing commas).
JSON Validator & Linter
Check JSON syntax and see the exact line and column of every error.
JSON Beautifier
Pretty-print and indent JSON for easy reading and debugging.
JSON Compare & Diff Tool
Find the difference between two JSON objects visually and quickly.
JSONPath Tester
Evaluate JSONPath expressions with filters and recursive queries.
JSON Schema Generator
Generate a JSON Schema from any sample JSON document.
JSON to CSV Converter
Flatten nested JSON arrays into CSV for spreadsheets.
YAML ⇆ JSON Converter
Convert YAML to JSON or JSON to YAML instantly.
CSV to JSON Converter
Convert CSV or TSV data to a JSON array of objects, with type detection.
JSON to TypeScript
Generate TypeScript interfaces from any JSON sample.
JWT Decoder
Decode and inspect JSON Web Tokens (JWT) Header and Payload.
JWT Generator
Create and sign HS256/HS384/HS512 JSON Web Tokens for testing.
Hash Generator (MD5, SHA)
Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes.
Password Generator
Generate strong, random passwords with the length and characters you choose.
Base64 Encoder ⇆ Decoder
Encode text to Base64 and decode Base64 to text for API debugging.
URL Encoder & Decoder
Cleanly encode special characters in URLs and decode query strings.
SQL Formatter & Beautifier
Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more.
CSS Minifier & Compressor
Optimize CSS by removing whitespace and comments to accelerate page load time.
JS Minifier & Compressor
Compress JavaScript to improve website speed and performance.
HTML Formatter & Beautifier
Beautify or minify HTML with clean, consistent indentation.
Markdown Editor & Preview
Write Markdown with a live preview and copy the HTML.
Word & Character Counter
Count words, characters, sentences and reading time as you type.
Case Converter
Convert text to camelCase, snake_case, kebab-case, Title Case and more.
Text Diff & Compare
Compare two texts and highlight every added and removed word or line.
Lorem Ipsum Generator
Generate placeholder paragraphs, sentences or words as text or HTML.
Fancy Text & Font Generator
Turn text into 𝐛𝐨𝐥𝐝, 𝘪𝘵𝘢𝘭𝘪𝘤, 𝓈𝒸𝓇𝒾𝓅𝓉 and other Unicode font styles you can paste anywhere.
Color Picker & Converter
Pick a color and convert between HEX, RGB and HSL instantly.
Color Palette Generator
Generate harmonious color palettes and export them as CSS, Tailwind or JSON.
CSS Gradient Generator
Build linear and radial CSS gradients visually and copy the code.
PX to REM Converter
Convert pixels to rem and rem to pixels for any root font size.
Regex Tester & Debugger
Test JavaScript regular expressions with live match highlighting and groups.
Cron Expression Generator
Build cron schedules, read them in plain English and preview next runs.
UUID / GUID Generator
Generate unique V4 UUIDs for database keys or testing.
Epoch converter online
Convert UNIX timestamps to human-readable dates and back instantly.
Time Zone Converter
Convert a time between time zones and compare cities side by side.
Random Number Generator
Generate random numbers in any range — unique, sorted or decimals.
Crop Image Online
Crop images exactly as selected with fixed aspect ratios. No upload, no resize, no quality loss.
Compress Image Online
Compress JPG, PNG & WebP images directly in your browser. No upload, no tracking, instant download.
Image Resizer
Resize images to exact pixels or a percentage, keeping the aspect ratio.
Image Converter (PNG, JPG, WebP)
Convert images between PNG, JPG and WebP in your browser.
Image to Base64
Convert an image to a Base64 data URI for CSS, HTML or JSON.
Image to Base64 FAQ
Drop an image on the box, click to choose a file, or paste an image with Ctrl/⌘ V. The Base64 data URI appears instantly, ready to copy as plain Base64, CSS, an HTML <img> tag or Markdown.
A data URI embeds a file directly in your code, like data:image/png;base64,iVBORw0…. Browsers display it like a normal image URL, without a separate download.
For small images such as icons, tiny logos or placeholders — usually under a few kilobytes — in CSS, HTML emails or JSON. They save an extra request but can't be cached separately.
Base64 represents every 3 bytes as 4 text characters, so the result is about 33% larger than the original image. That's why large images are better served as normal files.
Any image your browser can read, including PNG, JPG, GIF, WebP, SVG, AVIF and ICO.
No. The image is read with your browser's FileReader and converted on your device. Nothing is sent to a server.
