Free Tool

    Base64 Encoder / Decoder

    Encode text to Base64 or decode Base64 strings — including URL-safe variants.

    Base64 Encode

    What Is Base64 Encoding?

    Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It's widely used to embed binary data in text-based formats such as JSON, XML, HTML, email (MIME), and data URIs.

    When To Use This Tool

    Reach for this Base64 tool whenever you need to embed a binary value inside a text-only transport — generating Basic Auth headers, encoding a JWT signing key, embedding a small icon as a data URI, copying a TLS certificate between systems, or debugging an API payload that returns Base64-encoded blobs. Because everything runs locally in your browser, you can paste credentials and confidential payloads without sending them to a third-party server.

    Standard vs. URL-Safe Base64

    Standard Base64 uses + and / characters, which are reserved in URLs. URL-safe Base64 replaces them with - and _ and strips trailing = padding, making it safe for use in query strings and file names.

    Common Use Cases

    • Encoding API keys and tokens for transport in HTTP headers
    • Embedding small images as data URIs in HTML and CSS
    • Encoding email attachments (MIME Base64)
    • Storing binary data in JSON payloads
    • Decoding JWT token payloads for debugging
    • Generating HTTP Basic Authentication credentials (`Basic <base64(user:pass)>`)
    • Encoding binary payloads inside JSON when a multipart upload isn't an option
    • Inspecting JWT tokens — the header and payload segments are URL-safe Base64

    Base64 FAQ

    Common questions about Base64 encoding, decoding, and where it shows up in real systems.

    Is my data sent to a server when I use this tool?
    No. The encoding and decoding both run entirely in your browser via the native `btoa` and `atob` functions. The data you paste never leaves your device, which makes the tool safe to use for API keys, tokens, credentials, or any other sensitive payload you wouldn't want crossing the network.
    What's the difference between standard and URL-safe Base64?
    Standard Base64 uses `+` and `/` in its alphabet plus `=` padding. Both `+` and `/` have reserved meaning inside URLs, and `=` often gets percent-encoded, so embedding a standard Base64 string in a query parameter or path can corrupt it. URL-safe Base64 substitutes `-` for `+`, `_` for `/`, and strips trailing `=` padding — producing a value that passes through routers, log lines, and JWT segments untouched.
    Why is Base64-encoded data roughly 33% larger than the original?
    Base64 packs 3 bytes (24 bits) of input into 4 characters of output (each character carries 6 bits). The ratio is exactly 4/3 ≈ 1.333, plus up to 2 padding `=` characters when the input length isn't a multiple of 3. That's why you should avoid Base64 for large binary payloads where bandwidth matters — use a binary-safe transport (multipart upload, gRPC) instead.
    Can I use Base64 for encryption?
    No. Base64 is encoding, not encryption — anyone who sees the output can trivially reverse it back to the original bytes. If you need to protect sensitive data, encrypt it first (AES, ChaCha20-Poly1305, or a higher-level tool like libsodium) and then Base64-encode the ciphertext if you need to transport it through a text-only channel.
    Why does my decoded text show garbled characters?
    Two common causes. First, the encoded value may have been corrupted in transit — Base64 is fragile, and a single character change usually produces a different byte sequence. Second, the source bytes may not be UTF-8 text. This tool decodes assuming a UTF-8 string; if the original was a binary file (image, PDF, encrypted blob), the result will look like noise — that's expected. Save the decoded output to a file and open it with an appropriate viewer.
    How do I encode a binary file like an image?
    Browser `btoa` requires a string input, so paste this tool the file's text representation isn't enough for binary. For PNG/JPEG/PDF and similar files, use the browser's File API in a small script, or run `base64 < image.png` on macOS/Linux. The resulting string can be embedded directly into an HTML `` data URI.

    Monitor Your Infrastructure 24/7

    Keep your servers, APIs, and services running with Xitoring's monitoring platform.

    Start Free Monitoring