Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

JSON to Base64 Converter

Paste or upload JSON data to instantly encode it as a Base64 string

Your files never leave your browser
JSON Input0 chars, 0 lines
Drag & drop a JSON file here, or browse
Accepts .json, .txt files
Base64 Output0 chars
Ready·

Paste or drop any JSON and get a Base64 string back — ready for query parameters, JWT claims, Kubernetes secrets, or anywhere raw braces would cause trouble. Flip on Minify to strip whitespace first and keep the encoded output as short as possible. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste JSON
➔
UTF-8 Encode
➔
Base64 Output

Your JSON string first gets converted into raw UTF-8 bytes. Those bytes are then mapped to the Base64 alphabet — 64 safe ASCII characters (letters, digits, +, /) that won't break URLs, emails, or config files. The result is about 33% larger than the original, but it is guaranteed to survive any text-based transport without corruption.

Examples

Embedding API credentials in a config string

You need to pass a small JSON config through an environment variable that only accepts plain text.

INPUT
{"apiKey":"sk_live_abc123","region":"us-east-1"}
OUTPUT
eyJhcGlLZXkiOiJza19saXZlX2FiYzEyMyIsInJlZ2lvbiI6InVzLWVhc3QtMSJ9

Stuffing user metadata into a URL parameter

A redirect URL needs to carry JSON user data, but query strings can't handle braces or quotes directly.

INPUT
{"user":"jdoe","role":"admin","exp":1735689600}
OUTPUT
eyJ1c2VyIjoiamRvZSIsInJvbGUiOiJhZG1pbiIsImV4cCI6MTczNTY4OTYwMH0=

Encoding a nested config object for a data URI

You are building a bookmarklet or data URI that embeds a multi-level JSON config. The nested structure has characters that would break the URI without encoding.

INPUT
{"theme":{"colors":{"primary":"#6366f1","bg":"#ffffff"},"font":"Inter"}}
OUTPUT
eyJ0aGVtZSI6eyJjb2xvcnMiOnsicHJpbWFyeSI6IiM2MzY2ZjEiLCJiZyI6IiNmZmZmZmYifSwiZm9udCI6IkludGVyIn19

Who Uses This

👨‍💻 Backend Developers

Embedding JSON payloads in JWT claims, webhook headers, and environment variables.

⚡ DevOps Engineers

Packing config files into Base64 for Kubernetes secrets and CI/CD pipeline variables.

🎨 Frontend Developers

Creating data URIs or passing structured data through URL query strings without breaking.

📊 QA & Testers

Quickly encoding test fixtures and mock API responses for automated test suites.

Common Mistakes

Encoding invalid JSON

If your input has a trailing comma, missing quote, or unescaped character, the tool will encode the broken string — and whoever decodes it later gets garbage. Always validate your JSON first (the tool flags syntax errors, so check before copying the output).

Double-encoding by accident

Pasting a Base64 string back into the encoder gives you Base64-of-Base64. The output looks valid but won't decode to the JSON you expect. If the input starts with eyJ, you probably already encoded it once.

Forgetting about the 33% size increase

Base64 adds roughly a third more characters. A 750 KB JSON file becomes about 1 MB. If you are working with URL length limits (browsers cap around 2,000 characters), run the numbers before assuming the encoded version will fit.

Technical Details

Frequently Asked Questions

Is Base64 encoding the same as encryption?

Not even close. Base64 is an encoding — anyone can decode it instantly. It does not protect your data. If the JSON contains sensitive info like passwords or tokens, encrypt it separately before encoding. Base64 is about safe transport, not security.

Can I decode the Base64 string back to JSON?

Yes, 100%. Base64 is fully reversible. Run the string through any Base64 decoder (we have one right here) and you will get the exact same JSON back, whitespace and all — unless you minified before encoding.

Why does my Base64 output end with = or ==?

The equals signs are padding. Base64 works in groups of 3 bytes, and when your input length is not divisible by 3, padding fills the gap. One leftover byte gives you ==, two leftover bytes give you =. It is part of the spec and won't cause problems.

Should I minify JSON before encoding it?

Depends on what you need. Minifying strips spaces, tabs, and newlines, which makes the Base64 output shorter. Great for URLs and storage. But if someone is going to decode it and read it by eye, keeping the formatting is friendlier. The toggle is right there — try both and compare sizes.

Does this work with very large JSON files?

It handles files up to several megabytes without issues in modern browsers. Beyond that, you might hit browser memory limits. For really massive files — say 50 MB+ — a command-line tool like base64 on macOS/Linux is a better fit. But for everyday API payloads and configs, this tool won't break a sweat.

Share: