Encode or Decode Base64 — Free Online Converter

Switch the Base64 Encoder Decoder between Encode and Decode mode, paste your text or Base64 string into the input box, and read the converted result straight out of the output field below it. Full Unicode/UTF-8 support means accented letters, emoji, and non-Latin scripts convert cleanly too, and the whole thing runs in your browser without sending anything anywhere.

Computed LocallyNever StoredFull UTF-8 Support

Whether you're a developer inspecting data payloads, troubleshooting access headers, or embedding images in HTML, the base64 encoder decoder gives you instant, client-side conversion between plain text and base64 encoded strings — with zero data leaving your device. Understanding your encoded or decoded output empowers you to debug service responses faster, build more reliable web applications, and handle raw data safely across text-based protocols supporting internet protocols and data transmission.

How to Use This Base64 Encoder/Decoder Tool

This free tool is entirely client-side — everything runs locally in your client environment, so no data is ever submitted to a server. There is no software download required, no sign-up needed, and it is completely ad-free and publicly available. Simply paste your data into the input box and the result appears in the output area instantly.

  • To encode base64: Type or paste your plain content into the decoded field and click Encode. Your base64 result will appear immediately in the output section. You can then copy the result with a single click.
  • To decode base64: Paste the base64 content into the encoded field and click Decode. The decoded output will display the original plain content or raw representation.
  • To decode a file: Upload a raw file (image, PDF, or other raw content) or paste a base64 string representing a file. The tool handles file processing entirely within your client environment — uploaded files are processed locally and nothing leaves the client.
Working, Success, and Error States: The tool displays a working indicator while processing larger inputs, a success! message when conversion completes without issue, and an error! message if the input contains invalid base64 characters or malformed data. These states help you instantly identify conversion issues without manual inspection.

Advanced Options for Raw Data, Character Sets, and Line Breaks

The tool exposes several advanced options that give you precise control over your conversion and interpretation process, particularly when handling raw data or multi-entry inputs:

  • Character set selection: Choose your charset from the dropdown — typically UTF-8, but the tool supports many others via an auto-detect option. This character set selection determines how content is converted before conversion or after interpretation. Note that this setting is irrelevant for raw file inputs.
  • URL-safe mode (Base64URL): Switch to the web-safe variant when your output strings will appear in addresses, filenames, or access credential strings. This mode is address-safe and filename-safe by design.
  • Decode each line separately: Enable this option to interpret each line as an independent data entry — useful when you have multiple data entries separated by line breaks. Prior to processing, all non-encoded whitespace is removed to preserve input integrity.
  • Live mode: When enabled, the tool uses your client's built-in script routines to convert instantly, without any server processing or data submission whatsoever. Currently live mode supports only the UTF-8 character set.

All communications with the underlying server infrastructure use secure, protected connections (HTTPS). Any uploaded files are deleted after the first download attempt or after 15 minutes inactivity, whichever comes first. Review the privacy policy for full details on data handling.

What Is Base64 Encoding and How Does This Base64 Encoder Decoder Convert Raw Data to Text?

Base64 encoding is a raw-to-text encoding scheme — formally defined in RFC 4648 — that converts raw data into a set of 64 printable standard characters so the data can travel safely through text-based protocols such as web transfer layers, messaging systems (via content-transfer standards), and structured data formats. The conversion scheme does not add secrecy; it provides zero secrecy and is not a form of ciphering. Its value lies in data integrity: ensuring that raw content is not corrupted, lost, or modified during transport across systems that are not 8-bit clean.

The Base64 term originates from a specific content-transfer standard. The scheme is used broadly: message content transfer via structured encoding, data embedding in HTML, structured markup embedding, object notation embedding, preserving complex data in structured formats, and transmitting raw content through web headers and service responses. It is a foundational approach in web development, networking applications, and software development. A base64 encoder/decoder is therefore an essential utility for text processing tasks involving raw data.

Step-by-Step Encoding Breakdown: How the Conversion Works with the Bit Pattern and Index

Understanding the conversion at the bit level helps you reason about output strings and diagnose issues. The process operates on groups of six bits drawn from a continuous sequence of the input bytes.

The Base64 alphabet consists of exactly 64 characters: uppercase A–Z (26), lowercase a–z (26), digits 0–9 (10), plus the plus symbol (+) and the slash symbol (/). This gives the full printable symbol set — 64 standard characters total. These are all printable characters that survive text-based data transport without corruption or modification.

The encoding process works as follows:

  1. Convert input to raw form: Each input character is expressed as its standard numeric value, then as an 8-bit representation. For the classic leviathan example used by Thomas Hobbes, the word Man — bytes 77 97 110 — produces the byte sequence 01001101 01100001 01101110.
  2. Concatenate into a 24-bit group: The three 8-bit values are joined into a single 24-bit group: 010011010110000101101110. This grouping ensures the output always produces a multiple of 4 base64 characters.
  3. Split into six-bit groups: The 24 bits are divided into four groups of six bits: 010011, 010110, 000101, 101110. Each six-bit segment maps to one index value in the Base64 table (0–63), so four numbers emerge from three input bytes.
  4. Look up Base64 characters: Each index is mapped to its corresponding Base64 character, producing the base64 encoded output string.

The table below shows the full bit-pattern and index mapping for Man, mirroring the standard reference table:

Text contentMan
ASCII value7797110
Binary (8-bit)01001101 01100001 01101110
6-bit groups010011 | 010110 | 000101 | 101110
Index19  |  22  |  5  |  46
Base64-encodedT W F u

So the word encodes to TWFu — confirming that the process converts 3 raw bytes into 4 output characters. This is the core mechanic: every 3-byte block of raw input yields exactly 4 Base64 output characters, a 4:3 expansion ratio. The bit representations are mapped deterministically, making the process fully reversible — a reversible conversion with no ambiguity. This human-readable format is what enables the base-64 representation to survive intact across diverse systems.

Padding with the = sign: When the input length is not a multiple of three, padding characters (= signs) are appended to the output to fill the final 4-character group. One = means one byte of padding was added; == means two bytes were added. This padding ensures the output can be interpreted without ambiguity, since the interpreter needs to know how many raw bytes the final group contains. Padding is part of the standard Base64 format but is often removed in the address-safe variant.

Base64 is not real cryptography. It provides no confidentiality and should never be confused with ciphering. Any party can interpret a Base64 string without a key. If you need to protect data from unauthorized parties, use actual ciphering (such as AES) alongside base64 encoding for transmission.

Common use cases for base64 encoding and decoding include:

  • Data embedding: Embed assets like images directly in HTML, CSS, or structured object notation as data references (image to base64), avoiding separate web requests for small assets.
  • Data integrity during transmission: Prevents corruption of raw data when sent over protocols that only handle plain content — message transfer, web-layer transmission, and data in transit through text media. This supports reliable data transmission across internet protocols.
  • System interoperability: Facilitates platform interoperability and smooth data processing between systems that differ in how they handle raw content.
  • Data storage: Preserving raw data in databases or configuration files that expect a human-readable format — useful for keeping raw assets in text-only stores safely.
  • Data sharing and exchange: Simplifies data exchange and transfer in structured markup, object notation, and address-string contexts by expressing complex data as safe text strings. This is a core use of encoding schemes across modern software.

Base64 Encoding in Practice: Script Functions, Java, OAuth 2.0, and Access Credentials — A Free Online Tool Reference

Developers encounter base64 encoding across nearly every layer of modern software development — from client-side script routines to back-end services and OAuth 2.0 access flows. This section provides concrete, working code examples and explains the real-world contexts where the conversion operates every day.

Using Base64 in JavaScript with btoa and atob

In scripting environments, the built-in functions btoa() (raw-to-text — the btoa function) and atob() (text-to-raw — the atob function) handle base64 encoding and base64 decoding operations natively in every modern client environment and Node.js runtime. These built-in routines require no external library and enable encode base64 and decode base64 operations with a single line of code.

// JavaScript encoding and decoding with btoa / atob
let text = "Hello, world!";
let encoded = btoa(text);
console.log(encoded); // Outputs: "SGVsbG8sIHdvcmxkIQ=="

let encodedStr = "SGVsbG8sIHdvcmxkIQ==";
let decoded = atob(encodedStr);
console.log(decoded); // Outputs: "Hello, world!"

The console logs above confirm that btoa("Hello, world!") produces the output SGVsbG8sIHdvcmxkIQ==, and atob() reverses it to restore the original content. These JavaScript functions enable smooth data processing, and you can use them to encode binary data for data URIs and inspect payloads during troubleshooting workflows. For non-standard symbols or reserved characters, convert your string to a UTF-8 byte array first to avoid character conversion errors — a common source of issues in web applications.

The btoa/atob pair is ideal for in-browser tasks: converting payloads for network requests, embedding raw content in structured object data, and inspecting payloads received in service responses. You can examine headers, check access headers, and verify the output matches expectations — all without leaving the client environment.

Java Library Support with java.util.Base64

Java 8 introduced native support for the conversion via the java.util.Base64 class, eliminating the need for third-party libraries. The class provides three converters and three interpreters: a basic converter for standard Base64, a web-safe converter, and a content-transfer converter. This library support makes it straightforward to process strings and handle raw data in enterprise applications.

import java.util.Base64;

public class Base64Example {
    public static void main(String[] args) {
        String original = "Hello, world!";

        // Encoding
        Base64.Encoder encoder = Base64.getEncoder();
        String encodedValue = encoder.encodeToString(original.getBytes());
        System.out.println("Encoded: " + encodedValue);
        // Outputs: Encoded: SGVsbG8sIHdvcmxkIQ==

        // Decoding
        Base64.Decoder decoder = Base64.getDecoder();
        byte[] decodedBytes = decoder.decode(encodedValue);
        String decodedText = new String(decodedBytes);
        System.out.println("Decoded: " + decodedText);
        // Outputs: Decoded: Hello, world!
    }
}

The Base64.getEncoder() method returns a Base64.Encoder instance; Base64.getDecoder() returns a Base64.Decoder. For address-safe output in this language, use Base64.getUrlEncoder(), which replaces + with - and / with _ to produce filename-safe output suitable for web addresses. For content-transfer-compatible output with line breaks at 76 characters, use Base64.getMimeEncoder(). Reading a raw asset file and preserving raw data in a database are the most common real-world uses — converting data before storing or transmitting, then restoring it upon retrieval.

Base64URL vs. Standard Base64: Character Substitution Details

The base64url variant (defined in RFC 4648 as the address-safe and web-safe form) was designed specifically for use in web addresses, filenames, and credential formats where the standard plus symbol (+) and slash symbol (/) characters would conflict with address syntax or require percent-encoding. Base64URL makes two substitutions: + becomes - and / becomes _. Additionally, padding (the = signs) is typically omitted for address safety, producing a compact string that survives intact through address parameters, access headers, and web components without escaping. The standard base64 format is used in content-transfer, message systems, and general data transport; the base64url format is used in signed credential strings and contexts where address-format interoperability is mandatory.

Base64 Encoding in OAuth, Signed Credentials, and Web Security

Base64URL is the conversion format at the heart of modern identity and access systems. In OAuth 2.0 and OpenID Connect, JSON Web Tokens (JWT) use base64url to encode each of their three parts: the header, the payload, and the signature. Each section is a base64url-encoded object, separated by dots, forming the compact structure that makes signed credential strings suitable for web headers, addresses, and service responses.

The JWT header typically specifies the algorithm and token type; the payload carries the claims; and the signature is generated by combining the encoded header and payload with a secret or private key using a JSON Web Signature (JWS) algorithm, or by protecting the payload using JSON Web Encryption (JWE). The result is a credential string that is digitally signed (and optionally protected), making it integrity-protected against tampering by unauthorized parties. The message authentication code (MAC) or cryptographic signature means any modification of the base64 content in transit would invalidate the credential — a key guarantee. Signed credential strings are the primary access formats in modern identity systems, carrying claims between client and server.

In the OAuth 2.0 client credentials flow, the client ID and client secret are concatenated with a colon separator (client_id:client_secret) and then base64-encoded. This output is sent in the access header as Authorization: Basic <base64string>, following the web specification for basic identity verification. The server interprets the login details to verify the client's identity. This use of base64 encoding in access headers is one of the most common patterns in protected service communication and credential issuance.

Beyond signed credentials and OAuth, base64 encoding is used throughout web and networking applications for:

  • Converting keys and certificates — including public keys, private keys, and protected credentials — in public key cryptography and TLS certificate exchange.
  • Embedding raw content (images, PDFs, raw asset data) as inline references inside HTML, structured markup, or CSS — enabling web-friendly text delivery of raw resources and allowing developers to embed assets without separate web requests.
  • Converting form data and address parameters that contain raw representations or reserved characters that would otherwise break address format.
  • Transmitting access headers and OAuth credential strings across text-based protocols where raw data would cause corruption or loss.
  • Converting message attachments via content-transfer standards for messaging, ensuring safe passage through legacy mail systems that are not 8-bit clean.

Free Base64 Encoder Decoder: Privacy, Protection, and No-Server Architecture

This free base64 encoder decoder is a straightforward tool built for developers who care about data protection and privacy. It is 100% client-side — all conversion operations are processed locally, meaning nothing leaves the client and there is no remote server involved at any point. This is a critical distinction from tools that transmit your data to a remote server for processing — with this tool, your data stays on your device.

Key trust and transparency features of this free tool:

  • No server processing: Conversion happens entirely in the client environment using your runtime's native capabilities. Your content strings, raw inputs, and output strings are never sent anywhere.
  • Free to use with no sign-up: No account, no registration, no subscription. It is free to use with no restrictions on usage volume.
  • Publicly available: The tool's code is auditable — you can verify its behaviour and contribute improvements.
  • Secure connections: If you interact with any server-side features, all communications use protected, encrypted connections to safeguard data in transit.
  • Developer-friendly: Designed to integrate naturally into a developer tools workflow alongside tools like a URL encoder decoder, data escape/unescape converter, and credential inspector — making it an essential member of your dev-tools kit.

For developers troubleshooting conversion issues, inspecting service responses, or converting payloads during web development, having a client-side tool means your workflow stays fast and private. Whether you need to convert raw data from a network request, inspect the base64 encoded content inside an access header, or verify that your output matches an expected base-64 representation, this tool provides the data conversion you need without leaving your client tab. The tool is a developer-friendly, web-safe conversion resource — and since all operations run locally, it is equally suitable for handling sensitive login credentials, secrets, and certificates that you would never want to expose to a third-party server.

Frequently Asked Questions

Does this handle Unicode text correctly (emoji, accented characters, non-Latin scripts)?
Yes -- text is converted to UTF-8 bytes before Base64 encoding (and decoded back the same way), which correctly round-trips emoji, accented characters, and non-Latin scripts. A naive Base64 implementation built directly on the browser's btoa()/atob() functions breaks on any character outside the Latin-1 range; this tool avoids that by encoding through TextEncoder/TextDecoder first.
What does 'not valid Base64' mean?
It means the text you pasted into Decode mode isn't a valid Base64 string -- it contains characters outside the Base64 alphabet (A-Z, a-z, 0-9, +, /, and = for padding), or the length/padding doesn't form complete groups. Double-check you copied the full string with no extra characters.
Is Base64 encoding the same as encryption?
No. Base64 is an encoding, not encryption -- it has no secret key and anyone can decode it instantly. It exists to safely represent binary data (or Unicode text) using only printable ASCII characters, for contexts like email attachments, data URIs, JSON payloads, and HTTP headers that can't handle raw bytes. Never use Base64 alone to protect sensitive data.
Why would decoded text look like garbage?
That usually means the Base64 string doesn't represent valid UTF-8 text -- for example, if it's actually encoded binary data (an image, a compressed file) rather than text. This tool deliberately fails with a clear error in that case rather than silently showing corrupted text (mojibake).
Is my text sent anywhere?
No. Both encoding and decoding happen entirely in your browser -- nothing you type is transmitted, logged, or stored. Reload the page and everything is gone.