How to Encode or Decode
Base64 Online Free
Text and files. UTF-8 safe. URL-safe variant included. All processing happens in your browser.
Open Base64 ConverterWhen you actually need Base64
Base64 isn't something you reach for casually — it's a transport encoding for moving binary data through text-only channels. The everyday use cases: embedding small images inline as data URIs, encoding a file for an HTTP API that only accepts JSON strings, hand-crafting a JWT or OAuth token, generating a Basic Auth header, or pasting a binary blob into a config file.
For any of these, you want a tool that handles the encoding correctly the first time — including UTF-8 input, the URL-safe variant, and round-tripping back to bytes. The Base64 Converter does all three.
Step-by-step: encode or decode in seconds
Open the Base64 Converter
Visit the free Base64 Converter. It runs entirely in your browser using TextEncoder + the native btoa/atob primitives, with a UTF-8 wrapper so non-ASCII text encodes correctly.
Choose Encode or Decode
Toggle the direction. Encode turns plain text or a file into a Base64 string. Decode turns a Base64 string back into the original text or file.
Paste your text — or drop a file
Text mode handles UTF-8 strings up to several MB without lag. File mode reads any file with FileReader and produces a data URI you can copy or download.
Pick the variant if needed
Standard Base64 uses + and /. URL-safe Base64 uses - and _ instead so the string can sit safely in a URL or filename. JWT signatures, for instance, use URL-safe Base64 (without padding).
Copy or download the result
Click Copy to grab the encoded/decoded output. For binary outputs, the Download button writes the bytes to a file with the original extension preserved when possible.
Pro tips for clean encoding
UTF-8 first, then encode
JavaScript's btoa() throws on non-ASCII characters because it expects Latin-1 input. The tool wraps the string with TextEncoder to emit proper UTF-8 bytes before encoding — so emojis, accented characters, and CJK text all round-trip correctly.
URL-safe is mandatory in JWTs and OAuth
If you're hand-crafting a JWT or building an OAuth state parameter, use the URL-safe variant. Standard Base64 contains + / =, all of which need percent-encoding in URLs and break copy-paste workflows.
Data URIs need the right MIME prefix
If you're encoding an image to embed inline as data:image/png;base64,... make sure to prefix the encoded payload with the right MIME type. The tool's File mode includes the prefix automatically.
Don't use Base64 to compress
Base64 grows the data by ~33% — it's an encoding, not a compression. Useful for transport in text-only channels, but it's the opposite of what you want if size matters. Compress first (gzip), then encode.
API tokens, credentials, JWTs all stay private
Base64 is often the format you encounter sensitive data in (Basic Auth headers, JWT payloads, OAuth state). The encoder runs locally so you can paste a real token, decode it to inspect, and never worry about it leaving your machine.
Frequently asked questions
What is Base64 and why does it exist?
Base64 encodes binary data as ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). It exists because some channels — email bodies, URLs, JSON strings, XML attributes — can only carry text reliably. Base64 lets you send binary data through them at the cost of about 33% size inflation.
Why does plain JS btoa() break on non-English text?
btoa() expects each character's code point to be 0-255 (Latin-1). Anything outside that range (most accented Latin characters, CJK, emoji) throws a 'character out of range' DOMException. The fix is to UTF-8-encode the string with TextEncoder first, which the converter does automatically.
What's the difference between standard and URL-safe Base64?
Standard uses + / for the last two characters in its alphabet, plus = for padding. URL-safe replaces + with - and / with _ (so the string can appear in URLs without percent-encoding) and often omits padding. RFC 4648 §5 specifies the URL-safe alphabet.
Can I encode a binary file like an image or PDF?
Yes — switch to File mode and drop the file. Output is the file's bytes encoded as a single Base64 string. Useful for embedding images inline as data URIs or for moving binary blobs through a text-only channel like email or a config file.
How big a file can I encode?
Limited only by browser memory — typical desktop browsers can handle 100-500 MB before slowdowns start. The bottleneck is usually the resulting string's length and the clipboard's paste performance, not the encoding itself.
Is the data uploaded?
No. The encoder runs in your browser using TextEncoder + btoa (or atob for decode). Files are read via FileReader, which is also browser-local. There's no fetch to a server for any part of the conversion.