Base64 Encoder / Decoder

Encode plain text, HTML, or URLs to Base64 — or decode Base64 strings back to readable text. Switch between standard and URL-safe modes, encode files, and copy in one click.

URL-safe
Line Wrap
Plain Text (Input)
Base64 Output
🔢 Input size: 0 B
|
📏 Output size: 0 B
|
📈 Overhead:
|
Ready
📄 File to Base64 Encoder
Show ▼
📤
Click to browse or drag & drop a file here
Any file type — images, PDFs, documents, fonts
filename.ext — 0 KB
📚 Quick Reference — Common Base64 Values
Show ▼
🔒 Works 100% in your browser
⚡ Data never leaves your device
✓ No sign-up needed

FAQs About Base64

What is Base64 encoding and how does it work?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /, with = used as padding. The encoding works by taking three bytes (24 bits) of input at a time and splitting them into four groups of six bits each, then mapping each six-bit group to one of the 64 characters. This makes Base64 output approximately 33% larger than the original data. Base64 is not encryption — it is purely a way to represent binary data as text so it can be safely transmitted through systems that only handle ASCII, such as email (MIME), JSON APIs, or HTML attributes. If you need to measure the size of your plaintext before encoding, our Character Counter gives you a byte-level breakdown instantly.

What is the difference between standard Base64 and URL-safe Base64?

Standard Base64 uses + and / as the 62nd and 63rd characters. Both have special meaning in URLs (+ means a space in query strings; / is a path separator), so embedding standard Base64 in a URL can cause parsing errors or data corruption. URL-safe Base64 (defined in RFC 4648) replaces + with - and / with _, producing strings safe in URLs and filenames without percent-encoding. This variant is used in JSON Web Tokens (JWTs), OAuth 2.0 flows, and data URIs embedded in query parameters. Toggle the “URL-safe” switch above to convert between both formats. If you are embedding encoded strings in URLs you create, our Text to Slug Generator handles the URL-path component separately.

When should I use Base64 encoding?

Common use cases include: embedding images directly in HTML or CSS as data URIs (src="data:image/png;base64,...") to reduce HTTP requests; transmitting binary data in JSON APIs which only support text; attaching files in email via MIME encoding; storing binary keys, certificates, or tokens in environment variables or configuration files; and passing binary data in URL query parameters. Base64 is also used in HTTP Basic Authentication, where credentials are encoded as username:password before being placed in the Authorization header. For checking the word and character count of the plaintext you are about to encode, our Word Counter provides a full breakdown including unique words and reading time.

How do I decode a Base64 string?

Switch the tool to Decode mode using the button at the top, paste your Base64 string into the left panel, and the decoded plain text appears instantly on the right. A valid Base64 string contains only the characters A–Z, a–z, 0–9, +, / (or -, _ in URL-safe mode), and optional = padding at the end. If your string contains other characters, you will see a decoding error in red. Note that if the original data was binary (an image, PDF, or executable), the decoded output will contain unprintable characters and may not display meaningfully as text.

Can I encode files to Base64?

Yes. Expand the “File to Base64 Encoder” section above, then drag and drop any file onto the upload zone or click to browse. The tool reads the file entirely in your browser using the FileReader API — nothing is uploaded to any server. The resulting Base64 string is displayed in the output box and can be copied directly or downloaded as a ready-to-use data: URI. Data URIs are particularly useful for embedding small images or fonts directly into CSS or HTML, avoiding a separate HTTP request. File encoding works for any file type: PNG, JPEG, PDF, SVG, WOFF fonts, and more. If you need to compress a PDF before encoding it, use our Compress PDF tool to reduce the file size first.

Does Base64 compression reduce file size?

No — Base64 encoding increases file size by approximately 33% (every 3 bytes becomes 4 characters). The overhead stat in the tool shows you the exact increase for your data. Base64 is a representation format, not a compression algorithm. If reducing file size is your goal, compress the data first (gzip, Brotli, zlib) and then Base64-encode the compressed bytes if text transport is required. The overhead stat displayed in the tool above shows you exactly how much larger the encoded version is compared to the input.

Why does Base64 sometimes end with = or ==?

Base64 encodes data in 3-byte blocks. If the input length is not divisible by 3, padding characters (=) are added to the end to complete the final block. One trailing = means the original data had one byte of padding (input length was 1 mod 3), and two == means two bytes of padding (input length was 2 mod 3). Padding is required by the standard for correct decoding, though some implementations omit it. If you are decoding a string that is missing its padding, the decoder may fail; you can manually add = characters to bring the string length to a multiple of 4.

Is Base64 the same as encryption?

No. Base64 encoding is completely reversible and provides no security whatsoever. Anyone who has your Base64 string can decode it instantly with any standard library or with this very tool. It should never be used to protect sensitive data such as passwords, API keys, or personal information. For security, use proper encryption (AES-GCM, RSA-OAEP, etc.) or hashing (bcrypt, Argon2 for passwords). A common mistake is to see a Base64 string in a source file or API response and assume it is encrypted — it is not. For other text manipulation tasks that are similarly easy to do in-browser, see the Case Converter and Text to Slug Generator.

What is line wrapping in Base64 output?

By default, Base64 output is a single continuous string. However, RFC 2045 (the MIME email standard) specifies that Base64 lines should be wrapped at 76 characters with a CRLF line break. Some systems — particularly older email clients and PEM certificate files — require this wrapped format. Enable the “Line Wrap” toggle above to insert line breaks every 76 characters in the output. For most modern web and API use cases (JSON, HTML data URIs, JWTs), unwrapped single-line output is preferred. If you are pasting Base64 into a .pem or .crt file, the wrapped format is typically required. To count characters in the final output, our Character Counter is a quick companion tool.

How do I convert Base64 back to an image or file?

Use the “Decode” mode for text content. For binary files (images, PDFs, etc.), the encoded form is typically a data URI in the format data:image/png;base64,ENCODED_DATA. To convert it back to a file, paste the full data URI into your browser address bar and press Enter — most browsers will display or offer to download the decoded file. Alternatively, use the File to Base64 Encoder panel above: after encoding a file, the “Download Data URI” button recreates the original file from the Base64 data entirely within your browser, with no server involvement.

More Free Writing & Developer Tools

Convixy offers a full suite of free text and developer utilities alongside the Base64 encoder: