Công cụ này chạy hoàn toàn trên trình duyệt. Dữ liệu bạn nhập không rời khỏi thiết bị.
Advertisement
Công cụ này chuyển ảnh thành chuỗi Base64 dạng Data URI, cho phép nhúng ảnh thẳng vào file HTML hoặc CSS mà không cần thêm một yêu cầu tải file riêng. Phù hợp với icon nhỏ, logo đơn giản, ảnh nền dạng gradient hoặc ảnh cần hiển thị trong email HTML nơi ảnh ngoài thường bị chặn.
Cái giá phải trả là dung lượng: mã hóa Base64 làm dữ liệu phình lên khoảng 33% so với file gốc, và chuỗi này nằm chung trong file HTML nên không được trình duyệt cache riêng. Vì vậy chỉ nên nhúng ảnh dưới khoảng 10 KB; ảnh lớn hơn nên tải riêng để trang không bị chậm ở lần truy cập đầu.
Cách sử dụng
Tải ảnh lên hoặc kéo thả vào khung.
Chọn định dạng đầu ra và mức nén để giữ chuỗi ngắn.
Bấm chuyển đổi để nhận chuỗi Data URI đầy đủ.
Sao chép và dán vào thuộc tính src của thẻ img hoặc url() trong CSS.
This tool turns an image into a Base64 Data URI string, letting you embed it directly in HTML or CSS instead of firing a separate file request. It suits small icons, simple logos, gradient backgrounds, or images that must render inside HTML email where external images are often blocked.
The cost is size: Base64 encoding inflates data by roughly 33% over the original file, and the string lives inside the HTML, so the browser cannot cache it separately. Keep embeds under about 10 KB; larger images are better served as separate files so the page does not stall on first load.
How to use
Upload an image or drop it into the frame.
Choose the output format and compression to keep the string short.
Convert to get the full Data URI string.
Copy it into an img src attribute or a url() value in CSS.
Câu hỏi thường gặp
Nhúng ảnh Base64 có làm trang chậm không?
Với ảnh nhỏ thì không, thậm chí còn nhanh hơn vì bớt một yêu cầu mạng. Nhưng ảnh lớn sẽ làm file HTML phình to, chặn hiển thị trang và không được cache riêng, nên thường chậm hơn so với tải ảnh như file bình thường.
Base64 có làm ảnh bị giảm chất lượng không?
Bản thân mã hóa Base64 là không mất dữ liệu, chỉ đổi cách biểu diễn byte. Nhưng nếu bạn chọn xuất lại ảnh sang JPG trước khi mã hóa, chất lượng sẽ giảm do nén. Chọn PNG nếu muốn giữ nguyên từng điểm ảnh.
Vì sao ảnh Base64 không hiển thị trong một số ứng dụng email?
Nhiều ứng dụng email như Outlook cũ kỹ chặn ảnh dạng Data URI vì lý do bảo mật, dù đây là cách phổ biến để nhúng ảnh vào email HTML. Với email quan trọng, nên dùng ảnh có URL công khai thay vì Base64.
Does embedding Base64 images slow the page down?
For small images, no; it can even be faster by removing a network request. Large images bloat the HTML, block rendering, and are not cached separately, which usually makes them slower than loading the image as a normal file.
Does Base64 reduce image quality?
Base64 encoding itself is lossless; it only changes how bytes are represented. Quality drops only if you re-encode to JPG before encoding. Choose PNG if you need pixel-exact output.
Why do Base64 images not show in some email clients?
Older clients such as some Outlook versions block Data URI images for security reasons, even though it is a common technique for HTML email. For important messages, host the image at a public URL instead.