Tools
Base64 Encoder and Decoder
Encode any text to Base64 or decode a Base64 string back to the original. Works in the browser with full UTF-8 support, including accented and non-Latin characters.
Base64: the bridge between binary data and text
In many web contexts, such as REST APIs, email and authentication tokens, only text can travel. Base64 solves this by converting any binary data into a sequence of 64 safe characters that can cross any text channel without corruption or misinterpretation of special characters.
Contrary to what many people think, Base64 is not encryption. It is a reversible encoding with no key, designed for compatibility, not security. Understanding that distinction is essential to using it correctly in software development.
How Base64 works under the hood
The Base64 algorithm splits the input into groups of 3 bytes (24 bits). Each group is then divided into four 6-bit blocks. Since 6 bits represent values from 0 to 63, each block maps to one of the 64 characters in the Base64 alphabet. When the input length is not divisible by 3, = padding characters are added at the end.
That explains the roughly 33% size increase: 3 bytes become 4 characters. For plain ASCII text the output is always larger. The cost is worth it when compatibility with text-based systems is essential, such as embedding an image directly in the src attribute of an HTML tag.
Common uses of Base64 in web development
Data URIs let you embed images, fonts and other resources directly in HTML or CSS, saving an extra HTTP request. JWT tokens use Base64url, a URL-safe variant, to encode the header and payload. HTTP Basic authentication encodes the username and password in Base64 before sending them in the Authorization header. APIs that carry binary data, such as dynamically generated PDFs or screenshots, also rely on Base64 to include the data in JSON responses.
In email, the MIME standard uses Base64 to encode attachments and body parts that contain characters outside 7-bit ASCII, making sure the data arrives intact regardless of the mail servers along the way.
Base64 vs. encryption: a critical distinction
A dangerous mistake in development is treating Base64 as protection for sensitive data. A Base64 string can be decoded instantly by anyone who has it. There is no secret, key or proprietary algorithm involved. Passwords, API tokens, private keys and personal data should never be merely Base64-encoded.
To protect data in transit, use TLS (HTTPS). To protect data at rest, use symmetric encryption such as AES-256 or asymmetric encryption such as RSA. Base64 can be combined with encryption, for example by encrypting data with AES and then Base64-encoding the result for transmission, but Base64 itself adds no security layer.
Performance considerations when using Data URIs
Embedding images as Base64 Data URIs can look like an optimization because it removes HTTP requests, but it is not always the right choice. Base64 images are not cached by the browser independently. They are downloaded again with the HTML or CSS on every request, unlike external images that stay in the cache.
For small images used in many places (icons, logos), Data URIs in CSS can be efficient. For content images or banners, serving optimized external files in modern formats such as WebP or AVIF through a CDN is almost always more efficient. Weigh the context before adopting Base64 as a performance strategy.
Frequently asked questions
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9) and the symbols '+' and '/'. It is widely used to carry binary data over channels that only support text, such as email, JSON and HTML attributes.
When should I use Base64?
Use Base64 when you need to embed binary data in contexts that only accept text. The most common cases are Data URIs for inline images in HTML/CSS, JWT tokens (the payloads are Base64url), HTTP Basic authentication (encoded username:password), API payloads that do not accept binary and email attachments in MIME format.
Does this tool support special characters and accents?
Yes. The tool uses the TextEncoder API with UTF-8 before encoding, which guarantees correct support for accented characters such as é, ñ, ü and ç, as well as emoji and non-Latin scripts. Without that step, native browser functions like btoa() fail on characters outside ASCII.
Is Base64 a form of encryption?
No. Base64 is only an encoding, not encryption. Anyone can decode Base64 text without a key or password, using any decoder. Never use Base64 alone to protect sensitive information such as passwords or personal data. For that, use real encryption algorithms such as AES or RSA.
How much larger does Base64 make my data?
Base64 encoding increases data size by roughly 33%. That happens because every group of 3 bytes (24 bits) is represented by 4 Base64 characters (each representing 6 bits). A 1 MB file therefore becomes about 1.37 MB when Base64-encoded. This overhead matters when using Data URIs for large images.
What is the difference between standard Base64 and Base64url?
Standard Base64 uses the '+' and '/' characters, which have special meaning in URLs. Base64url replaces '+' with '-' and '/' with '_', making the result safe for URLs and file names without extra encoding. JWT tokens use Base64url. This tool works with standard Base64, so for JWT, check whether your system already does the conversion automatically.

