Base64 EncodeFree Online Base64 Encoder
Type text or upload a file and get the Base64 output instantly. Free and browser-based, supports UTF-8, URL-safe Base64 (-_), and data URI images. Nothing leaves your device.
Browse the Base64 encode quick reference or read the encoding guides.
What is Base64 encoding?
Base64 is a binary-to-text encoding that represents arbitrary bytes using 64 printable ASCII characters: the uppercase lettersA–Z (values 0–25), lowercase a–z (26–51), digits0–9 (52–61), and + (62) and / (63). Every 3 bytes of input become 4 Base64 characters. When the input length is not a multiple of 3, one or two = padding characters are appended, which is why so many Base64 strings end in = or ==. I built this encoder to do that instantly, in your browser, with no upload step.
A worked example
Encoding the text Hello, World! produces the Base64 string SGVsbG8sIFdvcmxkIQ==. The trailing == pads the output because the input did not fill the final 3-byte group. Type that text into the encoder above and you will see the same result.
Base64 is encoding, not encryption
This is the single most common misunderstanding. Base64 has no key and hides nothing: anyone can decode it straight back to the original bytes. It exists to move binary data through text-only channels such as email, JSON, and URLs, not to keep secrets. If you need to protect data, encrypt it (for example with AES), then Base64-encode the ciphertext for transport if needed. Encoding a password or token is never “securing” it.
Encode images and files
Upload a file and the encoder returns its Base64 form, which is how images get embedded inline in HTML, CSS, and JSON. For an image you usually prepend a data URI header like data:image/png;base64, so a browser renders it directly from the string. Base64 inflates size by about a third, so inlining is best for small assets.
URL-safe Base64 and JWTs
URL-safe Base64 (RFC 4648 §5) swaps + and / for - and _ so the string is safe in URLs and filenames, and it is the encoding used inside JSON Web Tokens. If your destination expects the URL-safe alphabet, encode with that variant rather than translating the characters yourself afterward.
Where Base64 shows up
- HTTP Basic Auth headers (
Authorization: Basic ...) - Email attachments encoded with MIME
- Inline images as data URIs in HTML and CSS
- Binary blobs inside JSON and XML API requests
- The header and payload segments of JWTs
Encode in your own code
The encoder above is handy for quick checks; in a program you usually encode in code. The essentials per language:
- Python:
base64.b64encode(s.encode()).decode()— full guide - PHP:
base64_encode($s)— full guide - Bash / Linux:
printf %s "$s" | base64— full guide - Go:
base64.StdEncoding.EncodeToString([]byte(s))— full guide - PowerShell:
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($s))— full guide - Node.js / JavaScript:
Buffer.from(s, "utf-8").toString("base64")— full guide
Privacy and history
Everything runs locally in your browser. I do not store, transmit, or analyze anything you type, you can confirm this by encoding with your Network tab open and seeing zero requests. The recent-encode history is kept only in your browser’s local storage and you can clear it whenever you like. All features are free, with no account required. When you need to go the other way, my Base64 decoder is the mirror of this tool.
Built and maintained by Ishan Karunaratne, a developer who reaches for Base64 tools often and wanted ones that are fast, private, and correct on the edge cases (padding, URL-safe output, and binary input). I also write about web development and security at techearl.com.
Base64 Encode: Frequently Asked Questions
What is a Base64 encoder?
A Base64 encoder converts data, readable text or raw binary such as an image or file, into a Base64 string. Base64 maps every 3 bytes of input to 4 ASCII characters drawn from A-Z, a-z, 0-9, and + and /, so binary data can travel safely through text-only channels like email, JSON, and URLs. The output is about a third larger than the input and often ends in one or two = padding characters. Yo! Base64 Encode is a free online encoder that does this entirely in your browser: type or paste text, or upload a file, and the Base64 result appears instantly. Nothing is uploaded to a server.
How do I encode text to Base64?
Type or paste your text into the box and the Base64 output appears immediately. Encoding runs locally in your browser, so the text never leaves your device. For text, the bytes are read as UTF-8 before encoding, which is what you want in almost all cases. If you need the URL-safe variant (used in JWTs and query strings), you can produce Base64 that uses - and _ instead of + and /. To go the other way and turn a Base64 string back into text, use the decoder at yobase64decode.com.
Is it safe to encode sensitive data here?
Yes. All encoding happens locally in your browser using JavaScript, so the text you paste is never sent to a server, stored, or logged. You can verify this yourself: open your browser's developer tools, switch to the Network tab, and encode a value, you will see that no network request is made. The optional history is kept only in your browser's local storage and never transmitted. That said, Base64 is not security (see below), so encoding a secret does not protect it.
Is Base64 encoding the same as encryption?
No, and this is the most common misconception. Base64 is an encoding, not encryption. It has no key and hides nothing: anyone can decode a Base64 string straight back to the original bytes. It exists to make binary data text-safe for transport (email, JSON, URLs, data URIs), not to keep it secret. So encoding a password or token in Base64 does not protect it. If your data needs to stay private, use real encryption (for example AES or age) and Base64-encode the ciphertext only if you need to move it through a text channel.
Can I encode an image or file to Base64?
Yes. Upload a file and the encoder returns its Base64 representation, which is how images are embedded inline in HTML, CSS, and JSON. For an image you typically prepend a data URI header such as data:image/png;base64, so a browser renders it directly from the string. Keep in mind that Base64 inflates size by roughly a third, so inlining is best for small assets; large files are usually better served as normal binary downloads.
What is URL-safe Base64 encoding?
URL-safe Base64, defined in RFC 4648 section 5, is a variant that replaces the two characters that cause trouble in URLs and filenames, + and /, with - and _, and often omits the trailing = padding. It is the encoding used inside JSON Web Tokens (JWTs) and many web APIs. Standard Base64 and URL-safe Base64 are not interchangeable character for character, so if your destination expects the URL-safe alphabet, encode with that variant rather than translating afterward by hand.
What is the difference between Base64 encode and decode?
Encoding and decoding are opposite directions of the same transformation. Base64 encoding takes raw bytes (text or binary) and rewrites them into the Base64 ASCII alphabet so they can travel through text-only channels; the result is about a third larger than the input. Base64 decoding takes that encoded string and reconstructs the original bytes. This site is an encoder: it turns text or a file into Base64. To go the other way, use the decoder at yobase64decode.com. The two tools are mirror images and share the same browser-based, nothing-uploaded approach.
December 11, 2024
December 11, 2024
December 11, 2024
December 11, 2024
December 11, 2024
Your encode history will appear here. Start encoding to build your history!