Base64 Encoder / Decoder

Encode or decode Base64 strings and files. Supports URL-safe mode.

Mode:

Base64 encoding is a method of representing binary data such as images, files, or raw bytes as a string of printable ASCII characters so it can be safely transmitted over text-based protocols like HTTP, email, or JSON. Developers use Base64 to embed images directly in CSS or HTML, encode file attachments in API payloads, and pass binary data through systems that only handle text. AlteredIdea's Base64 encoder and decoder runs entirely in your browser: no data is sent to any server.

Free online Base64 encoder and decoder

Base64 encoding is used everywhere in modern web development: embedding images in CSS, encoding binary payloads in JSON APIs, generating JWT tokens, and transmitting email attachments. This tool lets you encode plain text or binary files to Base64, and decode Base64 strings back to their original content, all without leaving your browser.

The URL-safe mode is especially useful for developers working with JWTs, OAuth tokens, or any situation where Base64-encoded data appears in a URL. Switch between standard and URL-safe output with a single checkbox. The File tab converts any binary file up to 5 MB into a data URL or raw Base64 string you can copy or download instantly.

Step-by-step guide

  1. 1
    Choose Text or File mode
    Use the Text tab to encode or decode a string, or the File tab to convert any binary file to a Base64 data URL.
  2. 2
    Select Encode or Decode
    In Text mode, toggle between Encode and Decode using the mode buttons in the options bar.
  3. 3
    Optionally enable URL-safe mode
    Tick URL-safe to replace + and / with - and _: required for Base64 used in URLs and JWT tokens.
  4. 4
    Paste your input
    Type or paste the plain text (for encoding) or the Base64 string (for decoding) into the input panel.
  5. 5
    Copy the output
    The result updates instantly. Click Copy to grab the encoded or decoded value for use in your project.

Related Tools

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using a 64-character alphabet (A–Z, a–z, 0–9, + and /). It is widely used to embed binary data such as images or files inside text-based formats like JSON, HTML, and email.
What is the difference between standard Base64 and URL-safe Base64?
Standard Base64 uses + and / which are reserved characters in URLs. URL-safe Base64 replaces them with - and _ respectively, making the encoded string safe to use as a URL parameter or in a JWT token without percent-encoding.
Does this tool upload my data anywhere?
No. All encoding and decoding is performed in your browser using the built-in btoa() and atob() functions. Nothing is sent to any server.
Why does Base64 increase file size?
Base64 encodes every 3 bytes of binary data as 4 characters, resulting in approximately a 33% size increase. This overhead is the trade-off for being able to transmit binary data through text channels.
Can I encode an image to Base64?
Yes. Switch to the File tab, drop or browse to an image file, and the tool outputs both the full data URL (data:image/png;base64,...) and the raw Base64 string without the prefix.
What file size limit is there for the File tab?
The File tab accepts files up to 5 MB. Larger files are rejected to keep the browser responsive. For larger files use a command-line tool like base64 (Linux/macOS) or certutil (Windows).
How do I decode a Base64 string back to text?
In Text mode, select the Decode toggle, paste the Base64 string into the input area, and the decoded plain text appears instantly in the output panel.
What characters are valid in a Base64 string?
Standard Base64 uses A–Z, a–z, 0–9, +, /, and = as padding. URL-safe Base64 replaces + with - and / with _. Any other characters indicate an invalid or corrupted Base64 string.
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. It is reversible by anyone without a key. Do not use Base64 to secure sensitive data: use proper encryption algorithms instead.
When should I use a data URL vs a raw Base64 string?
Use a data URL (data:mime/type;base64,...) when embedding the file directly in HTML or CSS. Use the raw Base64 string when storing the value in a database, API payload, or when the receiver expects the string without the prefix.

AlteredIdea vs alternatives

vs server-side tools: Everything runs in your browser: your data never leaves your device.

vs VS Code extensions: No install needed. Works instantly in any browser.

vs paid tools: Completely free, no account required.

Rate this tool: