Skip to main content

    Base64 Encoder & Decoder

    Encode text to Base64 or decode Base64 back to text. Supports UTF-8 and Unicode.

    No signup. 100% private. Processed in your browser.

    What Is Base64 and When Do You Need It?

    Base64 is a way of representing binary data using only text characters. It converts raw bytes into a string of letters, numbers, plus signs, and slashes — characters that survive being passed through systems that only handle text (like email, JSON, or HTML).

    Think of it like spelling out a phone number in words: "oh-seven-seven-oh" instead of 0770. The information is the same, just represented in a text-safe format. The trade-off? Base64 output is about 33% larger than the original data. That's the cost of text-safety.

    Important: Base64 is encoding, not encryption. Anyone can decode it instantly. Never use Base64 to "hide" passwords, tokens, or sensitive data — it provides zero security.

    Common Base64 Use Cases

    Use CaseWhy Base64?Example
    Data URIs in HTML/CSSEmbed small images directly in code<img src="data:image/png;base64,...">
    Email attachments (MIME)SMTP only handles 7-bit ASCII textContent-Transfer-Encoding: base64
    JSON payloadsJSON can't contain raw binary{"file": "SGVsbG8..."}
    JWT tokensHeader and payload are Base64URL encodedeyJhbGciOiJIUzI1NiJ9...
    HTTP Basic AuthCredentials encoded (not encrypted!)Authorization: Basic dXNlcjpwYXNz
    SVG in CSSInline SVG backgrounds without extra requestsbackground: url("data:image/svg+xml;base64,...")

    What this means for you: If you're embedding small icons (under 2KB) in CSS, Base64 data URIs save HTTP requests. For anything larger, a regular image file with proper caching is more efficient.

    Base64 vs Other Encodings

    EncodingCharacters UsedSize OverheadBest For
    Base64A-Z, a-z, 0-9, +, /+33%Binary data in text contexts
    Base64URLA-Z, a-z, 0-9, -, _+33%URLs, JWTs (no +/= characters)
    Hex0-9, a-f+100%Hash digests, colour codes
    URL encoding%XX formatVariableSpecial characters in URLs

    Common Base64 Mistakes

    Mistake

    Using Base64 for "security". Base64 is trivially reversible. Encoding a password or API key in Base64 provides zero protection. Use proper encryption (AES) or hashing (bcrypt) for sensitive data.

    Mistake

    Base64-encoding large images in CSS. A 50KB image becomes 67KB as Base64, and it can't be cached separately from the stylesheet. Only inline images under 2KB — anything larger should be a regular file with HTTP caching.

    Mistake

    Mixing Base64 and Base64URL. Standard Base64 uses + and / which break in URLs. JWTs use Base64URL (with - and _ instead). Decoding one with the other's alphabet produces garbage. Check which variant you need.

    Related Tools

    How to use this tool

    1

    Enter text or Base64 string in the input

    2

    Click Encode or Decode

    3

    Copy the result or swap input/output

    Common uses

    • Embedding small images in HTML/CSS as data URIs
    • Encoding binary data for JSON payloads
    • Decoding JWT token components
    • Preparing email attachments for MIME transport
    • Converting files for inline SVG backgrounds

    Share this tool

    Frequently Asked Questions