Base64 Encode & Decode – Convert Text, Files & Images to Base64

A free online tool to encode text and files to Base64 or decode them back to the original data.

Base64 Enc/Dec

Encode text

Encoding result

Decode text

Decoding result

Encode file

Encoding result

Preview

Decode file

Decoding result

Preview

Building something? Automate it with the Vivoldi API

Base64 encoding screen converting text and image files into Base64 strings

What to check when the result looks wrong

If the result is empty or shows garbled characters, check the Character Encoding setting first. When encoding and decoding use different character encodings, multibyte characters such as Chinese, Japanese, or Korean become garbled.

If the input contains spaces or line breaks, turn on Trim spaces and Ignore spaces, line breaks, and tabs in Conversion Options and try again. For binary data such as images or PDFs, use the Encode file and Decode file tabs.

Where Base64 is used in development

  • JWT: The header and payload are encoded in URL-safe Base64.
  • API: Binary files are sent as Base64 strings inside JSON responses.
  • Email: Attachments are Base64-encoded for transfer under the MIME standard.
  • Data storage: Some systems store binary data as Base64 text.

Base64 encoding and size increase

Base64 represents every 3 bytes as 4 characters, so the result is about 33% larger than the original.

Small files such as icons are convenient to embed directly in code, but high-resolution photos and videos significantly increase the transfer size. For large files, reference them by URL instead.

Base64 decoding: which strings to paste

Paste a Base64 string from an API response, raw email source, or JWT into the Decode text tab to restore the original text. Strings missing padding (=) are handled by Auto-correct padding.

If the decoded data is binary, such as an image or file, save the Base64 string as a text file and convert it in the Decode file tab. If the result shows garbled characters, check the Character Encoding setting.

Base64 vs. URL encoding vs. Hex encoding

  • Base64: Represents 3 bytes as 4 characters, making it shorter than Hex. Used to carry entire binary data as text.
  • Hex encoding: Represents each byte as 2 hexadecimal digits. Easy to read, but doubles the size.
  • URL encoding: Converts only characters not allowed in URLs to %XX and is designed for building URLs.

Frequently Asked Questions

Standard uses + and /, which have special meanings in URLs and can corrupt values. URL-safe replaces + with - and / with _, and is used in JWT, OAuth, and more. Use URL-safe for values in URL parameters. When decoding, Auto recognizes both formats.

A Base64 image can be embedded directly in code as a Data URI and displayed without a separate file. Add a prefix such as data:image/png;base64, before the file encoding result.

  • HTML: <img src="data:image/png;base64,...">
  • CSS: background-image: url("data:image/png;base64,...")

Because the size grows by about 33%, this suits small images such as icons. Shrink large images first with Compress Image.

No. Base64 is only an encoding that represents binary data as text. It provides no security, and anyone can decode it to recover the original. To protect passwords, personal data, or credentials, use encryption such as AES or RSA, and use Base64 only to carry the encrypted result as text.

Save the Base64 string (plain Base64 or a Data URI starting with data:) as a text file, upload it in the Decode file tab, and decode it. When done, use the Download button to get the original file; images can be previewed on screen. Files up to 5MB can be uploaded.

MIME Base64 follows the email standard (RFC 2045) and inserts a line break every 76 characters. Use it for email attachments or SMTP work. When decoding, Auto treats input with line breaks as MIME, so you do not need to select it.

Base64 is an encoding standard (RFC 4648) that represents binary data with 64 characters: letters, digits, and symbols. It carries data such as images and files through environments that handle only text, and is widely used for email attachments (MIME), Data URI images, binary transfer in APIs, and JWT.

Base64 converts every 3 bytes into 4 characters. If the input length is not a multiple of 3, the remaining positions are filled with = or ==. This is called padding. You can remove it if the receiving side accepts it: turn on Remove padding (=) below Base64 Format. This tool also decodes strings without padding using Auto-correct padding.