{
    "name": "Base64 Encoder and Decoder",
    "url": "https://calculators.geekmidst.com/calculators/base64-encoder-decoder",
    "markdown": "https://calculators.geekmidst.com/calculators/base64-encoder-decoder.md",
    "category": "IT, networking & security",
    "description": "Encode text to Base64 or decode Base64 back to text, using UTF-8, with standard or URL-safe alphabets as defined in RFC 4648. Runs in your browser.",
    "summary": "Base64 turns bytes into 64 safe text characters, three bytes at a time into four characters, so binary data can travel through systems built for text.",
    "also_called": [
        "Base64 converter",
        "Base64 encode/decode"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "mode",
            "label": "Action",
            "type": "segmented",
            "default": "encode",
            "options": {
                "encode": "Encode",
                "decode": "Decode"
            }
        },
        {
            "name": "variant",
            "label": "Alphabet",
            "type": "segmented",
            "default": "standard",
            "options": {
                "standard": "Standard (+ /)",
                "url": "URL-safe (- _)"
            }
        },
        {
            "name": "text",
            "label": "Text",
            "type": "textarea",
            "default": "Hello, world!"
        }
    ],
    "outputs": [
        {
            "key": "result",
            "label": "Result",
            "format": "text"
        },
        {
            "key": "input_bytes",
            "label": "Bytes of text (UTF-8)",
            "format": "integer"
        },
        {
            "key": "output_length",
            "label": "Characters in result",
            "format": "integer"
        }
    ],
    "formula": {
        "text": "Take the UTF-8 bytes 3 at a time (24 bits), split into four 6-bit groups, and map each to A–Z, a–z, 0–9, + and / (or - and _). Pad a final partial group with =.",
        "variables": {
            "= padding": "one = when the last group has 2 bytes, two when it has 1 (omitted in the URL-safe variant)"
        }
    },
    "worked_example": {
        "inputs": {
            "mode": "encode",
            "variant": "standard",
            "text": "foobar"
        },
        "steps": [
            "\"foo\" is bytes 66 6F 6F = 011001 100110 111101 101111 → Z m 9 v.",
            "\"bar\" is bytes 62 61 72 = 011000 100110 000101 110010 → Y m F y."
        ],
        "result": "\"foobar\" encodes to Zm9vYmFy (the RFC 4648 test vector)."
    },
    "interpretation": "Base64 output is about a third larger than the input. It is an encoding, not encryption: anyone can decode it.",
    "assumptions": [
        "Text is converted to bytes as UTF-8, the encoding used by the web."
    ],
    "limitations": [
        "Decoding is limited to results that are valid UTF-8 text; Base64 that contains an image or other binary file cannot be shown as text."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Is Base64 encryption?",
            "answer": "No. It only changes the representation of the data and can be reversed by anyone. Never use it to protect passwords or secrets."
        },
        {
            "question": "What is the URL-safe variant?",
            "answer": "RFC 4648 base64url replaces + with - and / with _ so the result can go in URLs and file names; the = padding is usually dropped."
        }
    ],
    "sources": [
        {
            "title": "RFC Editor (RFC 4648: The Base16, Base32, and Base64 Data Encodings)",
            "url": "https://www.rfc-editor.org/"
        }
    ],
    "related": [
        {
            "name": "URL Encoder and Decoder",
            "url": "https://calculators.geekmidst.com/calculators/url-encoder-decoder"
        },
        {
            "name": "Roman Numeral Converter",
            "url": "https://calculators.geekmidst.com/calculators/roman-numeral-converter"
        },
        {
            "name": "Website Bandwidth Calculator",
            "url": "https://calculators.geekmidst.com/calculators/bandwidth-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}