Base64 Encoder / Decoder

Encode text or files to Base64 and decode Base64 strings instantly

Base64 encoding is a method for converting binary data into plain ASCII text so it can be safely transmitted over text-based protocols like email, JSON, and HTTP. Developers use Base64 to embed images directly in HTML and CSS, pass binary payloads through REST APIs, and encode authentication credentials. Paste your text or upload a file below to encode or decode Base64 instantly.

0 chars
0 chars

Drag & drop a file here, or click to upload

How to Use This Base64 Encoder / Decoder

Base64 encoding converts binary data into a text format that can be safely included in HTML, CSS, JSON, XML, and email messages. Developers regularly need to encode API keys, embed images as data URIs, or decode Base64 strings received from external services. This free tool handles all of those tasks instantly in your browser, with no data ever leaving your device.

Step 1: Enter Your Text or Base64 String

Type or paste your content into the Input textarea on the left. If you want to encode plain text into Base64, enter the original text. If you want to decode a Base64 string back into readable text, paste the encoded string instead. The tool works with any length of input, from a single word to large blocks of data.

Step 2: Encode or Decode

Click the Encode button to convert your input into a Base64 string, or click Decode to convert Base64 back into plain text. If you prefer a hands-free workflow, enable the Auto-detect toggle. With auto-detect on, the tool analyzes your input as you type and automatically determines whether to encode or decode. It checks whether the input looks like valid Base64 and applies the correct operation without you pressing any button.

Step 3: Upload a File (Optional)

To convert a file to its Base64 representation, drag and drop it onto the upload area or click to browse your file system. The tool reads the file locally using the browser's FileReader API and outputs the Base64-encoded content in the output panel. This is especially handy for embedding images in HTML using data:image/png;base64,... data URIs, or for preparing binary payloads for REST API calls.

Step 4: Use URL-Safe Mode

Standard Base64 uses the characters +, /, and =, which conflict with URL syntax. Enable the URL-safe toggle to replace + with - and / with _, and strip padding. This is the format used by JSON Web Tokens (JWT), Amazon S3 signed URLs, and many modern APIs.

Step 5: Copy the Result

Click the Copy button to copy the output to your clipboard. The character counts on both panels help you verify the encoding overhead — Base64 typically produces output about 33% larger than the input. If your decoded output is a valid image, a preview automatically appears below the textareas so you can verify the result visually before copying.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of ASCII characters. It uses 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding. Base64 is commonly used to embed images in HTML or CSS, transmit binary data over text-based protocols like email and JSON, and store binary content in databases that only support text.

Is this Base64 tool free to use?

Yes, this Base64 encoder and decoder is completely free with no usage limits. Everything runs locally in your browser — your data is never sent to any server. There is no signup, no account, and no watermarks. Use it as many times as you need.

Is my data safe when using this tool?

Absolutely. All encoding and decoding happens entirely in your browser using JavaScript. Your input text and files never leave your device — nothing is uploaded to a server. You can verify this by disconnecting from the internet and using the tool offline. Your data stays private and secure.

What is URL-safe Base64?

URL-safe Base64 replaces the + character with - and the / character with _ so the encoded string can be used safely in URLs and filenames without percent-encoding. It also removes the trailing = padding characters. This variant is defined in RFC 4648 and is commonly used in JSON Web Tokens (JWT), URL parameters, and file naming.

Can I encode files and images to Base64?

Yes, you can drag and drop any file or click to upload it, and the tool will convert it to a Base64 string. This is useful for embedding images directly in HTML or CSS using data URIs, sending binary files through text-only APIs, or storing small files in JSON or XML configurations.

Why does Base64 encoding increase the size of data?

Base64 encoding increases data size by approximately 33% because it represents every 3 bytes of binary data as 4 ASCII characters. Each Base64 character encodes only 6 bits instead of the full 8 bits in a byte. This overhead is the tradeoff for being able to safely transmit binary data through text-only channels like email, JSON, and XML.

How do I decode a Base64 image and preview it?

Paste a Base64-encoded image string into the input field and click Decode. If the decoded data is a valid image (PNG, JPEG, GIF, WebP, or SVG), the tool automatically detects it and displays a preview below the output. You can also paste a full data URI like data:image/png;base64,... and the tool will handle it correctly.