JSON to Base64 Converter

Encode a JSON payload to Base64, or decode a Base64 string back to formatted JSON - instantly and privately.

Input
Output
🔒 100% client-side - your data never leaves your browser
Advertisement

Why Encode JSON as Base64?

JSON contains characters like { } " : , that can be problematic in contexts such as URL query parameters, HTTP headers, cookies, or binary message formats. Encoding a JSON payload as Base64 turns it into a safe, opaque string of letters, digits, and a few symbols that can be transported without escaping issues.

Common examples include encoding a state object into a URL parameter for OAuth redirects, embedding configuration in environment variables, or passing structured data through systems that only support plain text fields.

How This Tool Works

Encoding

Paste valid JSON into the input box. The tool validates the JSON, minifies it (removing unnecessary whitespace), and converts it to a Base64 string using UTF-8 encoding - so non-ASCII characters in string values are handled correctly.

Decoding

Paste a Base64 string into the input box in Decode mode. The tool decodes it, parses the result as JSON, and, if "Pretty-print decoded JSON" is enabled, formats it with 2-space indentation for readability.

Frequently Asked Questions

Base64-encoded JSON is safe to place inside URL parameters, HTTP headers, cookies, or binary protocols where raw JSON's special characters (quotes, braces) might cause parsing issues.

The input text isn't valid JSON syntax. Common causes include missing double quotes around keys, trailing commas, or using single quotes instead of double quotes. Validate the structure and try again.

Yes. Enable "Pretty-print decoded JSON" before decoding to format the output with 2-space indentation for easier reading. Disable it to get a minified single-line result.

Yes. Any valid JSON value - including deeply nested objects and arrays, strings, numbers, booleans, and null - can be encoded to Base64 and decoded back exactly as entered.

Related Tools