도구 가이드
developer 무료 회원가입 불필요

시간대 변환기

이미지 파일을 Base64 인코딩된 데이터 URI 문자열로 변환합니다.

도구를 불러오는 중…

이 도구에 대해

드래그 앤 드롭 또는 파일 선택기로 이미지를 업로드하면 즉시 Base64 인코딩된 데이터 URI를 얻을 수 있습니다. 데이터 접두사 포함 여부를 선택할 수 있습니다. 이미지를 인라인으로 삽입할 수 있는 편리한 HTML 및 CSS 코드 조각이 자동으로 생성됩니다.

사용 방법

  1. 1 1단계: 업로드 영역에 이미지를 드래그 앤 드롭하거나 클릭하여 파일을 탐색하세요.
  2. 2 2단계: 이미지 미리보기와 Base64 출력이 자동으로 표시됩니다.
  3. 3 3단계: '데이터 URI 접두사 포함' 토글로 출력이 data:image/...;base64,로 시작할지 여부를 제어하세요.
  4. 4 4단계: 복사를 클릭하여 문자열을 복사하거나 아래의 준비된 HTML / CSS 코드 조각을 가져가세요.

What Base64 encoding is and why images use it

Base64 is a way of writing binary data — like the bytes of a PNG or JPEG — using only 64 plain text characters (A–Z, a–z, 0–9, plus + and /). It exists because many systems were designed to carry text, not raw bytes: HTML, CSS, JSON, and email all expect printable characters. Base64 turns an image into a long string you can paste straight into those text-based formats. This tool reads your file with the browser's FileReader and produces a data URI — a string that begins with data:image/png;base64, followed by the encoded bytes — so the image effectively becomes part of your code.

Everything happens locally. The file is read in your browser and never uploaded, which makes it safe for screenshots, logos, or any image you'd rather not send to a server.

How the encoding works, with the math

Base64 takes the input three bytes at a time — that's 24 bits — and splits those 24 bits into four groups of 6 bits. Each 6-bit group (a value from 0 to 63) maps to one character in the Base64 alphabet. So every 3 bytes of image become 4 characters of text. When the file length isn't a multiple of three, the encoder pads the end with one or two = signs to signal how many bytes were real.

That 3-to-4 ratio is the key fact: Base64 output is about 33% larger than the original file. A 30 KB image becomes roughly 40 KB of text. The tool shows you the exact character count so you can see the size before you commit to embedding it.

A worked example

Drop in a small icon — say a 24×24 PNG that's 1,200 bytes on disk. The encoder processes 1,200 ÷ 3 = 400 groups, producing 400 × 4 = 1,600 Base64 characters, plus the data:image/png;base64, prefix. The tool then hands you three ready-to-paste outputs:

  • The raw Base64 / data URI (toggle the prefix on or off).
  • An HTML snippet: <img src="data:image/png;base64,iVBORw0K...">
  • A CSS snippet: background-image: url('data:image/png;base64,iVBORw0K...');

It also reads the file's name, MIME type, on-disk size, and the image's pixel dimensions, so you can confirm you embedded the right asset.

When embedding an image is the right call

  • Tiny, frequently used icons. Inlining a small icon removes one HTTP request, which can make a page feel faster on first load.
  • Self-contained emails and documents. An HTML email or a single-file report displays its images even offline because they travel inside the file.
  • CSS sprites and backgrounds for small decorative graphics that you don't want as separate downloads.
  • Quick prototypes and demos where you want one file with no external dependencies.

When NOT to embed — the trade-offs

  • Large images. The 33% size penalty plus the loss of caching make big embedded images a net loss. A normal <img src="photo.jpg"> can be cached by the browser and reused across pages; a data URI is re-parsed every time and bloats the HTML or CSS file it lives in.
  • Anything that changes. Inlined images can't be swapped without editing and redeploying the code that contains them.
  • Gzip won't fully save you. Base64 text compresses somewhat, but already-compressed formats (JPEG, PNG) gain little, so the encoded version usually stays larger than the original binary.

A good rule of thumb: embed images under a few kilobytes; link to anything larger.

Tips and common mistakes

  • Keep the prefix for browsers. The data:…;base64, prefix tells the browser what kind of data follows. Strip it (with the toggle) only when a system expects pure Base64 — for example, a JSON field that stores just the encoded bytes.
  • SVGs don't need Base64. Because SVG is already text, you can often inline it directly or use url("data:image/svg+xml,...") with URL-encoding, which is smaller than Base64.
  • Watch line wrapping. Some editors hard-wrap long lines; a data URI must stay on one unbroken line (or use proper continuation) or the image silently fails to load.
  • MIME type must match. The prefix here is set from the file's real type. Hand-editing image/png onto JPEG bytes will break decoding in strict browsers.
  • It's encoding, not encryption. Base64 is fully reversible and offers no security. Anyone can decode it back to the original image.

자주 묻는 질문

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}