UtilForge

Base64 Toolkit — Encode, Decode & Convert Files

The complete Base64 toolkit for developers. Encode text, decode Base64 strings, and convert files to/from Base64 — all client-side.

Enter text to auto-detect

Developer Export Templates

Generate reusable code snippets for your project

1 lines

Raw

Web

Data

Programming Languages

HTML <img>.html
1
<img src="data:image/png;base64," alt="Embedded Image" />

HTML <img>

Embeds a Base64 image directly into an HTML img tag. No external files needed.

Use Cases

  • •Email signatures
  • •Offline HTML pages
  • •Small icons and logos
  • •Single-file prototypes

Notes

Avoid for large images — external files load faster.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It is commonly used to embed images, files, or other binary data within text-based formats such as HTML, CSS, JSON, or XML. Our online Base64 encoder and decoder tool lets you instantly convert plain text to Base64 or decode Base64 strings back to readable text. All operations are performed client-side in your browser, meaning your data never leaves your device. The tool supports Unicode characters (including Chinese, Spanish accents, and emoji) through proper URI encoding.

FAQ

Why use Base64 encoding?

Base64 encoding is useful when you need to transmit binary data over media that only supports text. Common use cases include embedding images in HTML emails, storing binary data in JSON, and encoding authentication credentials in HTTP headers.

Does Base64 compress data?

No, Base64 is not a compression algorithm. In fact, Base64 encoding increases data size by approximately 33%. It is purely an encoding scheme to make binary data safe for text-based transport.

Does your tool support UTF-8 and Unicode?

Yes. Our Base64 tool uses encodeURIComponent and decodeURIComponent to properly handle Unicode characters including Chinese, Japanese, Arabic, Spanish accents, emoji, and any other UTF-8 text. This ensures your encoded data remains intact across different systems.

What is Base64URL and when should I use it?

Base64URL is a URL-safe variant of Base64 used in JWTs, OAuth tokens and query parameters. It replaces + with - and / with _, and omits the trailing = padding, so the string can be embedded in URLs without extra encoding. This toolkit produces standard Base64; for Base64URL, apply those character replacements to the result.

Why do some Base64 strings end with = or ==?

The = characters are padding. Base64 encodes data in groups of 3 bytes, and when the input length is not a multiple of 3, one or two = characters are appended so the output length is a multiple of 4. Padding carries no data and can be removed safely as long as the decoder restores it.

How do I convert an image to Base64 (data URI)?

Switch to the File Converter tab, upload your image and convert it to Base64. Prefix the result with data:image/png;base64, (or the matching MIME type) to get a data URI that works in img src attributes and CSS url() values. To turn a Base64 image back into a file, use the reverse direction in the same tab.

Why does btoa() fail with Chinese characters or emoji?

JavaScript's btoa() only accepts characters in the Latin-1 range, so Unicode text throws an error. Use encodeURIComponent first — btoa(encodeURIComponent(text)) — or paste the text into this toolkit, which handles UTF-8 correctly, including Chinese and emoji.

Found an issue with this tool?

Report a problem