Base64 Encoder
UTF-8 correct text encoding, plus drag-and-drop file-to-Base64 conversion.
Also known as: Base64 converter, Base64 encode tool, Data URI generator
How it works
- 1Choose Text or File mode.
- 2Type or paste text, or drag a file into the drop zone.
- 3Toggle URL-safe encoding if you need it (for JWTs or URL-embedded tokens).
- 4Copy the Base64 output, or for files, the ready-to-use data URI.
Why use Base64 Encoder
Correctly handles any Unicode text
Encodes via UTF-8 bytes first, so emoji and non-Latin scripts never break or corrupt, unlike plain btoa().
Encodes entire files
Drag and drop any file — images, PDFs, anything — to get its Base64 and data URI.
Ready-to-use data URIs
Files get a complete data:...;base64,... string, ready to paste into HTML or CSS.
URL-safe variant
One toggle switches to the URL-safe alphabet used by JWTs and URL-embedded tokens.
Live size stats
See input and output size update instantly as you type or upload.
Nothing uploaded
All encoding happens locally — your text or file never reaches a server.
Who uses Base64 Encoder
Embedding a small image inline
Convert an icon or small image to a data URI to embed directly in CSS or HTML.
Encoding an API payload
Base64-encode binary data or text for an API that expects it in that format.
Preparing a JWT segment
Use URL-safe encoding to match the format JWTs use for their header and payload.
Encoding text with emoji or accents
Correctly encode Unicode-heavy text that would break naive btoa()-based tools.
Sharing a file as plain text
Convert a small file into a text-safe Base64 string to paste somewhere that only accepts plain text.
Testing how an app handles Base64 input
Generate known Base64 output to feed into another tool or system for testing.
About Base64 Encoder
The simplest way to Base64-encode text in a browser is JavaScript's built-in btoa() function, and it has a well-known, easy-to-hit limitation: it only works correctly on Latin1 text (character codes 0-255). Feed it an emoji, an accented character outside that range, or text in Chinese, Arabic, or Cyrillic, and it either throws an error outright or produces silently corrupted output, depending on how it's called. A surprising number of "simple" online Base64 tools inherit this exact bug because they're thin wrappers around btoa() with no extra handling.
This tool avoids that entirely by encoding text as UTF-8 bytes first (via the browser's TextEncoder), then Base64-encoding those bytes — the correct, standards-compliant approach that handles any Unicode text without errors or corruption, whether that's a plain English sentence or a string full of emoji.
File encoding works differently from text: instead of reading a file as text (which would be meaningless for a binary file like an image), the file is read directly as bytes and encoded to Base64 as-is, alongside a ready-to-use data URI — the data:image/png;base64,... format that can be pasted directly into HTML, CSS, or an API payload without any extra formatting. Both the raw Base64 and the full data URI are available to copy separately.
A URL-safe variant is available for both text and file encoding, replacing the + and / characters that are valid in standard Base64 but have special meaning in URLs with - and _, and dropping the trailing = padding — the format used by JWTs and many URL-embedded tokens. Everything runs locally: your text or file is read and encoded entirely in your browser tab, never uploaded.
Base64 Encoder vs. other options
How Open Tools Library compares to desktop software and other online tools.
| Feature | Open Tools Library | Desktop software | Other online tools |
|---|---|---|---|
| Price | Free, unlimited | Varies | Often free |
| Unicode/emoji handling | Correct, UTF-8 based | Varies | Often broken (plain btoa) |
| File encoding | Yes, drag-and-drop | Varies | Sometimes text-only |
| URL-safe variant | Yes, one toggle | Varies | Rare |
| Data privacy | Never leaves your device | Stays local | Often sent to a server |
| Speed | Instant, live | Instant | Varies by site |
Pro tips
- Use URL-safe encoding whenever the result will be placed directly in a URL or used as a JWT segment.
- For images you'll embed inline in CSS or HTML, copy the full data URI, not just the raw Base64 string.
- Base64 output is roughly 33% larger than the original — factor that in for large files.
- If your text includes emoji or non-English characters, this tool's UTF-8-first encoding avoids the corruption a plain btoa() call would cause.
- For very large files, encoding happens in your browser's memory — extremely large files may be slow on lower-powered devices.
Technical specs
- Text encoding
- UTF-8 byte-safe (handles full Unicode)
- File support
- Any file type, via drag-and-drop
- Output formats
- Raw Base64, and data URI for files
- URL-safe variant
- Optional toggle
- Size overhead
- ~33% larger than original
- Processing location
- 100% local, in your browser
Privacy & security
Text and files people encode to Base64 often include real data — API payloads, images, tokens — that shouldn't need to pass through a stranger's server first.
All encoding, for both text and files, happens locally in your browser tab.
No account or signup is required to use this tool.
Nothing you type or upload is stored, logged, or cached anywhere.
Works the same for a public sample string as it does for a sensitive file.
Frequently asked questions
Is my text or file uploaded anywhere?
No. Both text and file encoding happen entirely in your browser — nothing is sent to a server.
Why does this handle emoji correctly when other tools don't?
It encodes text as UTF-8 bytes before Base64-encoding, the standards-correct approach — many simpler tools use plain btoa(), which only supports Latin1 characters and breaks on anything else.
What's a data URI and when do I need it?
A data URI embeds a file's content directly in a string like data:image/png;base64,..., which browsers and many apps can use in place of a file URL — handy for embedding small images in HTML or CSS.
What's URL-safe Base64 for?
Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 replaces them with - and _ and drops padding, the format JWTs and many URL tokens use.
Is there a file size limit?
No hard limit — very large files simply take longer to process, entirely on your device.
Can I encode more than one file at once?
Currently one file at a time — encode each file individually.
Troubleshooting
My encoded text looks garbled or throws an error on another tool
That other tool is likely using plain btoa(), which breaks on Unicode text. This tool's output is standards-correct UTF-8-based Base64; make sure whatever decodes it also expects UTF-8.
My file seems stuck encoding
Very large files take longer since everything happens in your browser's memory — give it a moment, especially on an older device.
I need the data URI but only see Base64
Data URIs are generated for file uploads specifically — switch to File mode and upload your file to get both the raw Base64 and the full data URI.
My URL-safe output has no padding and another tool expects padding
URL-safe Base64 conventionally omits the = padding characters; if a system strictly requires padded input, add = characters back until the length is a multiple of 4.
Related searches
Landed here looking for something worded a little differently? Base64 Encoder covers all of these too:
Ready to use Base64 Encoder?
Free, private, and ready right now — no signup required.
Scroll to Base64 Encoder