Input

Mode:

Output

What Is JSON to Base64?

Sometimes you need to embed a JSON payload somewhere that only accepts plain text — an HTTP header, a query parameter, a config file value, or a JWT claim. Base64 is the standard way to do that: it turns arbitrary bytes into a safe ASCII string. This tool lets you go either direction: paste JSON and get Base64, or paste Base64 and get back the original JSON — pretty-printed and ready to read.

All processing happens entirely in your browser using the btoa() and atob() APIs. No data ever leaves your machine. Toggle between Encode (JSON → Base64) and Decode (Base64 → JSON) using the mode buttons.

How to Use This Tool

1

Choose Mode

Select Encode to convert JSON to a Base64 string, or Decode to convert a Base64 string back to formatted JSON.

2

Paste Input

Paste your JSON or Base64 string into the left editor. Click Sample to load an example, or Upload to read from a file.

3

Copy or Download Result

The right panel updates automatically as you type. Hit Copy to copy the result to your clipboard, or Download to save it as a file.

Example

Encoding a simple JSON object to Base64:

JSON Input

Input

Base64 Output

Output

Frequently Asked Questions

Why encode JSON as Base64?

JSON often contains characters like {, ", and colons that can break URL parameters, HTTP headers, or config formats that only allow ASCII text. Base64 converts the JSON into a safe, compact string. It's widely used in JWTs, Authorization headers, and embedded config payloads.

Does this tool handle Unicode and emoji in JSON?

Yes. The encoder uses encodeURIComponent + unescape before calling btoa(), which correctly handles the full UTF-8 range including emoji, CJK characters, and other non-Latin scripts. See the MDN Unicode + Base64 guide for how this works.

Will the decoded JSON be formatted or minified?

When you decode Base64 back to JSON, the tool pretty-prints the result with 2-space indentation using JSON.stringify(parsed, null, 2). This makes it easy to read no matter how the original was formatted.

Can I paste a Data URI (data:application/json;base64,...) to decode?

Yes. If your Base64 string starts with data:, the tool automatically strips the Data URI prefix before decoding. Just paste the whole thing and it works.

Is my JSON data private?

Completely. All encoding and decoding runs locally in your browser using JavaScript — no network requests are made. You can verify this by opening your browser's Network tab while using the tool. Your data never touches a server.

What's the difference between Base64 and Base64url?

Standard Base64 (used here) uses + and / characters plus = padding. Base64url replaces those with - and _ (no padding) for use in URLs and JWTs. The RFC 4648 §5 defines the URL-safe variant.

Related Tools

The Base64 encoding scheme is defined in RFC 4648. The JSON format is specified in RFC 8259. See also MDN: Base64 and json.org.