Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 strings directly in your browser. Supports UTF-8 text, standard and URL-safe Base64, file encoding, and Data URIs — with nothing uploaded to a server.
Runs 100% in your browser — your data is never uploaded to a server.
Plain text → Base64
Everything runs locally in your browser. Your text and files are never uploaded, logged, or stored. Base64 is an encoding, not encryption — anyone with the encoded value can decode it.
Working with tokens or API data too? Decode auth tokens with the JWT Decoder & Inspector, tidy payloads with the JSON Formatter & Validator, or turn JSON into models with the JSON to C# Converter.
Security notice: Base64 is an encoding method, not encryption. Anyone with the encoded value can decode it. Do not use Base64 as a replacement for encryption, password hashing, or secure secret storage, and always use HTTPS when transmitting sensitive information.
What Is Base64?
Base64 is a binary-to-text encoding that represents arbitrary binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = used for padding. Defined in RFC 4648, it lets you move binary data safely through channels that expect text — JSON and XML payloads, MIME email, HTTP headers, cookies, and URLs.
Because three bytes (24 bits) map to four Base64 characters, the encoded output is about one-third larger than the original data. Base64 is an encoding, not compression or encryption.
Base64 Encoder and Decoder
This free online Base64 encoder and Base64 decoder converts text to Base64 and back in real time, right in your browser. It is built for developers: backend and API engineers, .NET and C# developers, JavaScript and TypeScript developers, DevOps engineers, and anyone debugging encoded data. Switch between Encode and Decode, pick standard or URL-safe Base64, and copy or download the result.
How to Encode Text to Base64
- Select the Encode mode.
- Type or paste your text (UTF-8, including Unicode and emoji).
- Optionally choose URL-safe Base64 or drop the padding.
- Click Encode to Base64 (or press Ctrl/⌘ + Enter).
- Copy or download the Base64 output.
SGVsbG8sIFdvcmxkIQ==How to Decode Base64 to Text
- Select the Decode mode.
- Paste your Base64 string (line breaks are ignored by default).
- Keep Strict decode on to catch malformed input, or turn it off to be more tolerant.
- Click Decode Base64.
- Copy the decoded UTF-8 text.
Hello, World!Base64 vs Base64URL
Standard Base64 uses +, /, and = padding. URL-safe Base64 (Base64URL) replaces the characters that have special meaning in URLs: + becomes -, / becomes _, and padding is often omitted. Both encode the same bytes, but they are not always interchangeable — the decoder must know which alphabet produced the string.
PDw/Pz8+Pg==PDw_Pz8-Pg==URL-safe Base64 is common in JWTs, URLs, web tokens, and URL-safe identifiers.
Is Base64 Encryption?
No — this is the most important thing to understand about Base64. Base64 is an encoding scheme, not encryption.
- Encoding changes how data is represented so it can travel through text-only channels. It is fully reversible by anyone.
- Encryption protects data using cryptographic keys so that only authorized parties can read it.
Base64 does not secure passwords, API keys, tokens, personal information, or secrets. Where security matters, use proper encryption (such as AES or TLS/HTTPS) and hash passwords with a dedicated algorithm like bcrypt, scrypt, or Argon2.
Base64 for API Development
Base64 shows up throughout API and web development: API payloads, binary fields in JSON, Data URIs, file-transfer formats, and the segments of a JWT. A classic example is HTTP Basic Authentication, where username:password is Base64-encoded into an Authorization header:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=Note that this only encodes the credentials — it does not protect them. Base64 offers no confidentiality, so credentials must always be sent over HTTPS. Never treat Base64 as a way to hide secrets. JWTs use Base64URL for their header and payload; to inspect them, use the JWT Decoder & Inspector.
Base64 in C# and .NET
In C# / .NET, encode and decode Base64 like this:
using System.Text;
var text = "Hello, World!";
var bytes = Encoding.UTF8.GetBytes(text);
var base64 = Convert.ToBase64String(bytes);
// SGVsbG8sIFdvcmxkIQ==var bytes = Convert.FromBase64String(base64);
var text = Encoding.UTF8.GetString(bytes);
// Hello, World!Encoding.UTF8.GetBytes converts text to UTF-8 bytes, Convert.ToBase64String encodes them, and Convert.FromBase64String plus Encoding.UTF8.GetString reverse the process. For URL-safe Base64, use Base64Url (in .NET 9+) or adjust the characters manually.
Base64 in JavaScript
In the browser, btoa() and atob() only handle Latin-1 and will corrupt or throw on arbitrary Unicode. The modern, UTF-8-safe approach uses TextEncoder / TextDecoder — which is exactly what this tool does:
// Encode
const bytes = new TextEncoder().encode("नमस्ते 🚀");
const base64 = btoa(String.fromCharCode(...bytes));
// Decode
const binary = atob(base64);
const out = new TextDecoder().decode(
Uint8Array.from(binary, (c) => c.charCodeAt(0))
);Newer runtimes also offer Uint8Array.prototype.toBase64() and Uint8Array.fromBase64(), which handle the alphabet and padding for you.
Encoding Files with Base64
Switch to File mode to encode any file — images, PDFs, JSON, XML, CSV, ZIP, or other binary files — to Base64. The file is read locally with FileReader and ArrayBuffer; nothing is uploaded. You get the raw Base64, a ready-to-use Data URI, and (for images) a preview. You can also go the other way: paste Base64 or a full data: URI, set a file name and MIME type, and download the decoded file.
Very large files are processed in memory, so this tool caps file encoding to keep your browser responsive.
Base64 Data URIs
A Data URI embeds a resource directly into a URI using Base64, so it can live inline in HTML or CSS instead of being a separate request:
data:image/png;base64,iVBORw0KGgoAAAANSUhEU…Data URIs are handy for small images, icons, CSS backgrounds, and email templates. Keep them small, though — a large embedded resource increases document size and can’t be cached separately, so it isn’t a good fit for every asset.
How Base64 Works
Base64 encodes data in fixed-size groups:
3 bytes (input)
↓
24 bits
↓
4 × 6-bit values (0–63)
↓
4 Base64 charactersEach 6-bit value indexes into the Base64 alphabet. When the input isn’t a multiple of three bytes, the final group is padded with one or two = characters so the output length is always a multiple of four. For example, Hello (5 bytes) encodes to SGVsbG8= — note the trailing =.
Base64 Encoding Examples
SGVsbG8sIFdvcmxkIQ==4KSo4KSu4KS44KWN4KSk4KWH8J+agA==eyJuYW1lIjoiU1IgVG9vbHMifQ==Every value above is generated by the same encoder that powers the tool, so the examples are always accurate.
Common Base64 Use Cases
- Embedding images and fonts as Data URIs in HTML/CSS.
- Carrying binary data inside JSON, XML, or YAML.
- HTTP Basic Authentication headers.
- JWT header and payload segments (Base64URL).
- Email attachments via MIME.
- Storing small binary blobs in text columns or config files.
- Debugging and inspecting encoded API responses.
Is This Base64 Tool Private?
Yes — your data stays in your browser. Encoding and decoding are performed locally in JavaScript. Your text, files, and Base64 strings are never uploaded to our server, logged, stored in cookies or localStorage, sent to analytics, or added to the URL. Only your tool preferences (like variant and wrap settings) are remembered locally.
Frequently Asked Questions
- What is Base64?
- Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). It is defined in RFC 4648 and is widely used to safely transmit or embed binary data in text-based formats such as JSON, XML, email (MIME), and URLs.
- What is a Base64 encoder?
- A Base64 encoder converts text or binary data into a Base64 string. This tool encodes UTF-8 text (and files) to Base64 entirely in your browser.
- What is a Base64 decoder?
- A Base64 decoder converts a Base64 string back into the original text or binary data. This tool decodes Base64 to UTF-8 text, and can also decode Base64 back into a downloadable file.
- How do I encode text to Base64?
- Choose Encode, paste or type your text, and click Encode to Base64. The Base64 output appears instantly, ready to copy or download. Everything runs locally in your browser.
- How do I decode Base64 to text?
- Choose Decode, paste the Base64 string, and click Decode Base64. The decoded UTF-8 text appears on the right. The tool ignores line breaks by default and can auto-detect URL-safe Base64.
- Is Base64 encryption?
- No. Base64 is an encoding, not encryption. It changes how data is represented but does not protect it — anyone with the encoded value can decode it. Never use Base64 to secure passwords, tokens, or secrets.
- Is Base64 secure?
- Base64 itself provides no confidentiality or security. It is reversible by design. For confidentiality use real encryption (e.g. AES/TLS); for passwords use a dedicated password-hashing algorithm.
- What is Base64URL (URL-safe Base64)?
- URL-safe Base64 (Base64URL) is a variant defined in RFC 4648 §5 that replaces + with - and / with _, and often omits padding, so the value is safe to use in URLs and file names. JWTs use Base64URL for their header and payload.
- What is the difference between Base64 and Base64URL?
- Standard Base64 uses + and / and pads with =. URL-safe Base64 uses - and _ instead and may drop the = padding. They encode the same bytes but are not always interchangeable — the decoder must know which alphabet was used.
- Can Base64 encode Unicode text?
- Yes. This tool converts text to UTF-8 bytes first (using TextEncoder), then Base64-encodes those bytes, so accents, CJK characters, and emoji all round-trip correctly. The naive btoa() approach does not handle arbitrary Unicode.
- Can I encode JSON to Base64?
- Yes. Paste your JSON into Encode mode. If you decode Base64 back to JSON, the tool offers a shortcut to the JSON Formatter so you can pretty-print it.
- Can I encode an image to Base64?
- Yes. Switch to File mode and select an image (or any file). The tool reads it locally with FileReader/ArrayBuffer and produces both a Base64 string and a ready-to-use Data URI, with a preview for images.
- Can I decode Base64 files?
- Yes. In File mode, choose Base64 → File, paste the Base64 (or a full data: URI), set a file name and MIME type, and download the decoded file. Images are previewed before download.
- Does Base64 increase data size?
- Yes. Base64 encodes every 3 bytes as 4 characters, so the encoded output is roughly one-third (about 33%) larger than the original, with the exact overhead depending on padding.
- Can Base64 be used for passwords?
- No. Base64 does not hash or encrypt anything. Passwords should be securely hashed with a purpose-built algorithm such as bcrypt, scrypt, or Argon2 — never merely Base64 encoded.
- Is my data uploaded?
- No. All encoding and decoding happen locally in your browser using JavaScript. Your text and files are never uploaded to a server, logged, stored, or added to the URL.
Related Developer Tools
JSON Formatter & Validator
Format, beautify, validate, and minify JSON online. Runs entirely in your browser.
Open toolJSON to C# Converter
Convert JSON into C# classes, records, and models with namespaces and serialization attributes.
Open toolJWT Decoder & Inspector
Decode JWT headers and payloads, inspect claims, and check expiration — entirely in your browser.
Open toolSQL Formatter & Beautifier
Format and beautify SQL queries with customizable indentation, keyword casing, and dialect support.
Open toolUUID Generator & Validator
Generate random UUID v4 and time-ordered v7 identifiers, generate in bulk, validate UUIDs, and inspect versions — all in your browser.
Open tool