Encode text, images, and files to Base64 format with drag-and-drop support
📝InputNo Input
📁
Click to select a file or drag and drop here
📤OutputNo Output
Encoded/decoded output will appear here...
💡 Sample Data
Try these examples to test the encoder/decoder:
About Base64 Encoder/Decoder
Our free online Base64 encoder and decoder helps developers convert text, images, and files to Base64 format and vice versa. Whether you're embedding images in HTML, encoding binary data, or working with API responses, our tool provides comprehensive Base64 conversion capabilities.
Features
Text Encoding: Encode text strings to Base64 format
File Encoding: Upload and encode files to Base64
Image Support: Encode images with preview functionality
Drag & Drop: Easy file upload with drag-and-drop support
Data URL Output: Generate data URLs for web use
Line Break Options: Control Base64 output formatting
Copy & Download: Easy export options for encoded data
How to Use
Choose between text input or file upload mode
Enter text or upload a file to encode
Select output format (Base64 or Data URL)
Click "Encode to Base64" or "Decode from Base64"
Copy or download the result
Common Use Cases
✅ Web Development: Embed images in HTML/CSS
✅ API Development: Encode binary data for transmission
✅ Email Attachments: Encode files for email systems
✅ Data Storage: Store binary data as text
✅ Debugging: Inspect encoded data structures
About this tool
Free Online Base64 Encoder and Decoder
Base64 encodes binary data (or any text) into a string of 64 safe ASCII characters — A–Z, a–z, 0–9, +, and / — making it safe to transmit in contexts that only support text: HTTP headers, JSON payloads, email, and data URIs. NeatJSON's encoder and decoder runs entirely in your browser with no uploads.
How Base64 Works
Base64 takes 3 bytes of input (24 bits) and splits them into four 6-bit groups. Each group maps to one of 64 printable characters. The result is always about 33% larger than the input. If the input length isn't a multiple of 3, = padding characters fill the output to a multiple of 4.
Base64 is not encryption. Anyone can decode a Base64 string without a key. Never use it to hide sensitive data.
When to Use Base64
Data URIs — embed images inline in HTML/CSS: data:image/png;base64,...
JWT tokens — the header and payload are Base64URL-encoded (URL-safe variant using - and _)
Email attachments — MIME encoding transmits binary files as text over SMTP
API payloads — send binary content in JSON, which has no native binary type
HTTP Basic Auth — encodes username:password for the Authorization header
How do I Base64-encode a string in JavaScript?
Use btoa('hello') → 'aGVsbG8='. For Unicode, encode first: btoa(encodeURIComponent('héllo')). To decode: atob('aGVsbG8='). Modern code can also use TextEncoder with Uint8Array for full binary support.
Why does Base64 output end in = or ==?
Padding. Base64 encodes 3 bytes at a time. If the input isn't divisible by 3, = signs pad the output to a multiple of 4 characters. One = means 2 padding bits; two == means 4 padding bits.
What is the difference between Base64 and Base64URL?
Standard Base64 uses + and /, which have special meaning in URLs. Base64URL replaces them with - and _ for safe use in URLs and headers without percent-encoding. JWTs use Base64URL.