Skip to content
Devtools 360

Encode Text or Files to Base64

Convert text to Base64 using proper UTF-8 bytes, so accents, CJK characters and emoji encode correctly. You can also encode any file up to 10 MB and copy the result as a data URL.

Runs in your browserFree · No sign-up

How to encode to Base64

  1. Type or paste text, or choose a file with "Encode a file instead".
  2. Tick "URL-safe alphabet" for Base64URL (JWTs, URL parameters) or "Wrap lines at 76 characters" for MIME email bodies.
  3. Copy the Base64 output, copy it as a data URL (files only), or download it as a .txt file.

Supported formats

Input
Text, Any file
Output
Base64, Base64URL, data: URL
Maximum size
10 MB per file (limited by your device's memory)

Benefits

  • UTF-8 correct: avoids the "character out of range" error that btoa() throws on non-Latin text.
  • Encodes any binary file, not just images, with type information for the data URL.
  • Shows the size overhead so you can judge whether embedding is worth it.

Limitations

  • Base64 output is about 33% larger than the input, so a 10 MB file becomes roughly 13.3 MB of text.
  • Very large outputs can make the text box slow to scroll in some browsers.

Privacy and security

Text and files are encoded in this browser tab with JavaScript. Files are read locally and never uploaded.

Read our privacy policy for details about the site as a whole.

Frequently asked questions

What is the difference between Base64 and Base64URL?

Base64URL replaces + with - and / with _ and usually drops the = padding, so the result can be used in URLs and file names without escaping. JWTs use Base64URL.

Is Base64 encryption?

No. Base64 is a reversible encoding that anyone can decode. Never use it to hide passwords or secrets.

Why does my output differ from another tool?

Tools that call btoa() directly treat text as Latin-1, which breaks on non-ASCII characters. This encoder always uses UTF-8 bytes, which is what almost every API expects.