If you work with web development, email, APIs or data files, you will run into strings like SGVsbG8gV29ybGQ=. That is Base64, a way of writing any data, including text, images or binary files, using only safe, printable characters. It shows up in email attachments, data URLs, API authentication headers, JSON Web Tokens and configuration files.
This guide shows how to use the free Base64 Encode / Decode tool on RexBD, explains how Base64 works in plain terms, and clears up the most common misunderstanding: Base64 is not encryption.
What Base64 is and why it exists
Computers store everything as bytes. Many older systems, especially email, were designed to carry plain text only. Sending raw binary data, such as an image, through them could corrupt it, because some byte values had special meanings or were changed in transit.
Base64 solves this by converting any bytes into a set of 64 safe characters:
- AโZ (26 characters)
- aโz (26 characters)
- 0โ9 (10 characters)
- + and / (2 characters)
That is 64 characters in total, which gives the format its name. The = sign is used as padding at the end.
How the conversion works
Base64 takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, which maps to one of the 64 characters. Three bytes of input always become four characters of output.
That is why Base64 output is about 33% larger than the original. If the input length is not a multiple of three, padding characters (= or ==) fill the gap.
How to use the Base64 tool
Step 1: Choose encode or decode
Open the Base64 Encode / Decode tool. Encode turns normal text into Base64. Decode turns Base64 back into readable text.
Step 2: Paste your input
Paste the text or Base64 string. The tool runs in your browser, so tokens, credentials and private data are not uploaded.
Step 3: Get the result
The output appears immediately. Copy it.
UTF-8 and Bangla text
A common problem with simple Base64 tools is that they break on non-English characters, such as Bangla letters, accented letters or emoji. That happens when the tool encodes characters directly instead of converting the text to UTF-8 bytes first. The RexBD tool is UTF-8 safe, so "เฆเฆฎเฆพเฆฐ เฆธเงเฆจเฆพเฆฐ เฆฌเฆพเฆเฆฒเฆพ" encodes and decodes correctly.
Where you will see Base64
| Where | What it looks like | Why Base64 is used |
|---|---|---|
| Email attachments | Long blocks of characters in the raw email | Email was designed for text |
| Data URLs in HTML/CSS | data:image/png;base64,iVBORw0... |
Embed small images directly in code |
| HTTP Basic Authentication | Authorization: Basic dXNlcjpwYXNz |
Header must be plain text |
| JSON Web Tokens (JWT) | Three Base64URL parts separated by dots | Safe to send in URLs and headers |
| API payloads | Files sent inside JSON | JSON cannot hold raw binary |
| Kubernetes secrets and configs | Values encoded in YAML | Store binary safely in text files |
| Certificates and keys (PEM) | Text between BEGIN and END lines | Share binary keys as text |
Base64 is not encryption
This is the single most important thing to understand. Base64 is an encoding, not encryption. Anyone can decode it instantly, without a password or key. It hides nothing.
For example, HTTP Basic Authentication sends a username and password as Base64. dXNlcjpwYXNz decodes straight to user:pass. That is why Basic Authentication must only be used over HTTPS, where the whole connection is encrypted.
If you need to protect data:
- Use real encryption, such as AES. The Text Encryptor encrypts text with a password in your browser, and the File Encryptor does the same for files.
- Use hashing to verify data or store passwords, such as SHA-256 or bcrypt. See the Hash Generator and Bcrypt Generator.
Never treat Base64-encoded values in code, configuration or URLs as secret.
Base64URL: the URL-safe variant
Standard Base64 uses + and /, which have special meanings in URLs, and =, which can cause problems in query strings. Base64URL replaces + with - and / with _, and usually removes the = padding.
JWTs use Base64URL. If you try to decode a JWT segment with a standard decoder, it may fail because of these differences. For tokens, use the JWT Decoder, which handles the format correctly.
A worked example: reading an encoded value in a config file
Suppose you are debugging a deployment and find a configuration value like this:
DB_PASSWORD: c3VwZXJzZWNyZXQxMjM=
You suspect the application is using the wrong password. You paste the value into the decoder and see the original text immediately. Now you can compare it with the expected password and find the mismatch.
This example also shows why Base64 is not protection. Anyone with access to that file can do exactly what you just did. Real secrets should live in a secrets manager or encrypted storage, with access controlled, not just Base64-encoded in a shared file.
Encoding files and images
This tool works with text. To turn an image into a Base64 data URL for embedding in HTML or CSS, use the Image to Base64 tool. For any other file type, such as a PDF or font, use File to Base64.
Embedding images as Base64 is useful for very small icons, because it saves a separate download. For larger images it is usually worse: the data is 33% bigger, it cannot be cached separately and it makes your HTML or CSS heavier. A good rule is to embed only images of a few kilobytes or less.
Common mistakes and how to avoid them
Decoding produces garbled characters
The original data was probably not text, such as an image or compressed file, or it was text in a different character encoding. Base64 decoding gives you the original bytes; if those bytes are an image, they will look like nonsense as text.
"Invalid character" errors
The input contains characters that are not in the Base64 alphabet, such as spaces, line breaks or URL-safe characters (- and _) in a standard decoder. Remove whitespace, or convert URL-safe characters back to standard ones.
Missing padding
Some systems remove the = padding. Many decoders handle this, but if one fails, add = characters until the length is a multiple of four.
Double encoding
Encoding an already-encoded string produces a longer string that decodes only to the first Base64 version, not the original. If a decoded value still looks like Base64, decode it again.
Treating it as security
Covered above, but worth repeating: never rely on Base64 to hide passwords, tokens or personal data.
When to use Base64, and when not to
Base64 is a tool for a specific job: moving binary data through systems that only handle text. It is the right choice when:
- You need to put binary data inside JSON, XML, YAML or another text format.
- You are building an email with attachments by hand.
- An API or header specification requires it, such as HTTP Basic Authentication.
- You want to embed a very small image or font directly in HTML or CSS.
- You need to copy a small binary value, such as a cryptographic key, through a chat or ticket without corruption.
It is the wrong choice when:
- You want to hide or protect information. Use encryption instead.
- You want to make data smaller. Base64 makes it bigger. Use compression instead.
- You are sending large files over HTTP. Normal file uploads (multipart form data) are more efficient than Base64 strings inside JSON.
- You are storing large images in a database. Store the file and keep a link to it instead.
Keeping these cases in mind prevents the most common misuse: Base64-encoded "secrets" sitting in public code repositories.
Base64 in different programming languages
Most languages have built-in Base64 functions:
- JavaScript:
btoa()andatob()in browsers, though these do not handle UTF-8 directly; useTextEncoderfirst. In Node.js,Buffer.from(text).toString('base64'). - Python: the
base64module, for examplebase64.b64encode(text.encode('utf-8')). - PHP:
base64_encode()andbase64_decode(). - Command line:
base64on Linux and macOS.
The online tool is ideal for quick checks while debugging, without writing code.
Our practical uses of Base64 article explores more real-world scenarios.
Frequently asked questions
Is Base64 encryption?
No. It is an encoding that anyone can reverse instantly. Use real encryption to protect data.
Why does Base64 make data bigger?
Every three bytes become four characters, so the output is about 33% larger than the input.
What does the = sign at the end mean?
It is padding, added when the input length is not a multiple of three bytes.
Does the tool support Bangla and emoji?
Yes. It encodes text as UTF-8 first, so any language and emoji work correctly.
Is my data sent to a server?
No. Encoding and decoding happen in your browser.
Is the tool free?
Yes. It is free with no sign-up.
Keep reading
How to Test Regular Expressions Online: A Practical Regex GuideDeveloper ยท 7 min read
How to Decode a JWT and Check Its Expiry (JSON Web Token Guide)Developer ยท 8 min read
How to Generate UUIDs Online: Version 4 UUIDs ExplainedDeveloper ยท 7 min read
How to Format, Validate and Fix JSON Online (JSON Formatter Guide)Developer ยท 7 min read
How to Write a Cron Expression (With a Free Cron Builder)Developer ยท 7 min read
Gold Weight Converter Guide: Bhori, Ana, Rati, Point and GramsUnit converters ยท 8 min read
