Base64 Encoder & Decoder
Encode and decode text, files and images locally with Base64, Base64URL, MIME and Data URI support
Examples
Encode UTF-8 text as standard Base64
Hello, World!
helloBase64("Hello, World!") = SGVsbG8sIFdvcmxkIQ==
Base64("hello") = aGVsbG8=The trailing equals signs are padding that completes the final four-character Base64 block.
Decode Base64 back to text
SGVsbG8=HelloDecoding reconstructs the original bytes, which are then interpreted here as UTF-8 text.
Compare standard Base64 with Base64URL
🚀Standard Base64: 8J+agA==
Base64URL: 8J-agAFor the same UTF-8 bytes, Base64URL replaces the standard plus character with a hyphen and this representation omits padding.
About this tool
Base64 converts binary data into text by regrouping every 3 bytes into 4 characters drawn from A–Z, a–z, 0–9, + and /. Because 24 bits become four 8-bit characters, encoded output grows by roughly a third, and = signs pad the final group when the input length is not a multiple of 3. This workspace applies the same rules to plain text, whole files and images.
Encoding options cover the variants you meet in practice: Base64URL swaps + and / for - and _ so values survive URLs and file names, MIME mode wraps output at a line length you choose, and Data URI mode prefixes a media type for direct embedding. Padding can be omitted, and decoding offers strict canonical validation or a lenient mode that tolerates stray whitespace.
One thing Base64 does not do is protect data. It is a reversible, keyless encoding that anyone can undo, so treat it as a transport format, never as secrecy. The Image tab can also resize a picture before encoding and produces ready-to-paste HTML, CSS and Markdown snippets of the resulting data URI.
How to use this tool
Pick a tab
Use Text for strings, File to turn any document into Base64 or back into bytes, and Image to build a data URI with a preview.
Provide your input
Paste text or Base64, drop a file in, or select an image — conversion runs as you type.
Set the variant
Choose standard, Base64URL, MIME or Data URI output, and toggle padding or strict validation to match the reader.
Copy the result
Copy the encoded string, or download decoded bytes under the file name and type you specify.
Use cases
Embedding small resources in Data URLs
Encode a small image or text asset for a data: URL when an inline resource is more convenient than a separate request.
Moving binary bytes through text formats
Represent a compact binary value inside a text-only field such as a JSON string, XML element, or environment variable, then decode it at the receiving boundary.
Preparing URL-safe protocol values
Use Base64URL when a specification such as JOSE/JWT requires the hyphen-and-underscore alphabet and commonly omits padding.
Inspecting encoded application data
Decode a Base64 field from an API response, configuration file, email, or log to determine which bytes or text it contains.
Common mistakes
Mistake:Treating Base64 as encryption or secure obfuscation.
Fix:Anyone can decode Base64 without a key. Use authenticated encryption when data must remain confidential, and never put a secret in a public value merely because it looks encoded.
Mistake:Removing trailing = padding without checking the receiving protocol.
Fix:Padding may be omitted only when the protocol explicitly permits it or the decoder restores it. Keep canonical padding for standard Base64 when interoperability requirements are unknown.
Mistake:Encoding characters with one charset and decoding the bytes with another.
Fix:Agree on the byte encoding, normally UTF-8, at both ends. A Latin-1/UTF-8 mismatch produces different bytes or mojibake even when the visible source text looked identical.
Mistake:Assuming standard Base64 is safe in every URL or JSON-adjacent protocol.
Fix:A plain JSON string can carry + and /, but URLs and token profiles may give those characters special meaning. Use Base64URL only where the surrounding specification requires its - and _ alphabet.
Frequently asked questions
Why does Base64 make data about 33% larger?
Each output character carries only 6 bits, so 3 input bytes (24 bits) require 4 output characters. That fixed 4-to-3 ratio plus padding produces the roughly one-third size increase.
What is Base64URL?
A URL-safe variant that replaces + with - and / with _, letting encoded values appear in query strings, JWTs and file names without percent-encoding.
How do I decode a Base64 image?
Paste the data URI or raw Base64 into the Image or File tab. The image workspace previews the picture and reports its dimensions; the file workspace saves the decoded bytes to disk under a name you control.
Is Base64 a form of encryption?
No. It is a public, keyless encoding intended for transport, and anyone can reverse it instantly — never rely on it to hide passwords, tokens or other secrets.
Related guides
How Text Becomes Bytes: Binary, Hex, and UTF-8 Explained
What happens when you save a text file, how UTF-8 encodes characters, and why the same string can be different lengths in binary.
Gzip, Deflate, and CompressionStream: Browser-Native Compression
What RFC 1952 actually specifies, how gzip differs from zlib and deflate-raw, and how to use CompressionStream in modern browsers without any library.
URL Encoding Explained: A Practical Guide to Percent-Encoding
Why URLs can't contain spaces or special characters, how percent-encoding works, and how to avoid the classic pitfalls — double-encoding, + vs %20, and encodeURI vs encodeURIComponent.
Base64 Encoding Explained: What It Is and When to Use It
What Base64 actually does, why it exists, and when you should (and shouldn't) use it — covering the alphabet, padding, Base64URL, Data URIs, and common mistakes.
References & standards
Related tools
Base64 Image Encoder
Open the Image workspace in Base64 Toolbox to resize and convert images to Base64 data URIs, then copy HTML, CSS, Markdown or JavaScript snippets.
URL Encoder/Decoder
Encode and decode URLs with multiple modes, auto-detection, file upload, and comprehensive analysis
JWT Token Decoder
Decode and analyze JSON Web Tokens with security validation
GZip Compressor
Compress and decompress text with gzip, deflate, or deflate-raw