JSON to Base64 Online.

Encode JSON as standard or URL-safe Base64, decode Base64 back to valid JSON, generate data URIs, wrap raw Base64 lines, and minify JSON before encoding. Everything stays in your browser.

No signup / No uploads / Encode and decode

Base64 output

Convert JSON to Base64 online

A JSON to Base64 tool converts valid JSON text into a Base64 string that can be copied into APIs, test fixtures, config values, data URIs, tokens, or encoded examples. Paste JSON above, choose standard Base64 or URL-safe Base64, and copy the encoded result. The converter validates JSON before encoding so broken input does not become confusing encoded output.

How to encode JSON to Base64

  1. Paste JSON into the input box or load the sample.
  2. Choose encoding options - standard, URL-safe, data URI, wrapping, and minify before encode.
  3. Encode and copy the Base64 output or download it as a text file.

Decode Base64 to JSON on the same page

Switch to Base64 to JSON mode when you need the reverse conversion. The decoder accepts standard Base64, URL-safe Base64, wrapped Base64, and JSON data URIs, then validates the decoded text as JSON. You can pretty-print or minify the decoded JSON before copying it.

URL-safe Base64, data URIs, and line wrapping

URL-safe Base64 is useful for query strings, URL paths, and systems that do not want +, /, or padding characters. Data URI output creates a copy-ready data:application/json;base64 value. Raw Base64 can be wrapped at 64, 76, or 120 characters per line for systems that expect chunked output.

Base64 is not encryption — this matters

Worth being blunt, because people get this wrong in ways that cause real breaches. Base64 provides zero security. It is an encoding, not encryption. There is no key, and anyone can reverse it instantly:

echo "eyJwYXNzd29yZCI6ICJodW50ZXIyIn0=" | base64 -d
# {"password": "hunter2"}

Base64 makes data transport-safe, not secret. Never use it to hide passwords, tokens, or personal data — and remember that a JWT's payload is Base64, not encrypted, so anyone holding the token can read every claim inside it. If you need secrecy, encrypt.

What Base64 is genuinely for

Moving JSON through channels that mangle certain characters: a URL query parameter, an HTTP header, a cookie, an environment variable, or a data URI. Base64 reduces arbitrary text to a small alphabet of letters, digits, and two symbols that survive the trip intact.

URL-safe Base64, and why you need it

Standard Base64 uses + and /. Both have special meaning in a URL — + is often read as a space and / is a path separator — so a token pasted into a link can silently corrupt.

URL-safe Base64 substitutes - and _ instead, and usually drops the trailing padding. It is what JWTs use. If the value is going into a query string or a path, pick it.

Encode and decode in code

// Browser / Node — the TextEncoder step handles Unicode correctly
const encoded = btoa(String.fromCharCode(...new TextEncoder().encode(json)));
const decoded = new TextDecoder().decode(
  Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0))
);
# Python
import base64, json
encoded = base64.b64encode(json.dumps(data).encode()).decode()
decoded = json.loads(base64.b64decode(encoded))

Plain btoa() throws on any non-Latin-1 character, which is why the TextEncoder step above exists — it is the single most common Base64 bug in JavaScript, and it only shows up the first time a user types an emoji or an accented name.

Minify JSON before Base64 encoding

Minifying before encoding removes whitespace from the JSON text first, which usually produces a shorter Base64 string. Turn minify off when you want the decoded result to preserve readable indentation. You can also use JSON Minifier, JSON Formatter, or JSON Validator before encoding. For a full walkthrough, read how to convert JSON to Base64.

FAQ

JSON to Base64, answered.

How do I convert JSON to Base64 online? +

Paste valid JSON into the JSON to Base64 tool and press Encode JSON to Base64. The tool validates the JSON, optionally minifies it, then encodes the JSON text as Base64 in your browser.

Can I decode Base64 back to JSON on the same page? +

Yes. Switch to Base64 to JSON mode, paste standard Base64, URL-safe Base64, or a data URI, and the tool decodes the text back into validated JSON.

Does the tool support URL-safe Base64? +

Yes. Choose URL-safe Base64 to replace plus and slash characters with hyphen and underscore and remove padding. Decode mode can auto-detect URL-safe Base64.

Can I create a JSON data URI? +

Yes. Enable Output data URI to generate a data:application/json;base64 URI. You can also choose text/plain when that MIME type fits your use case better.

Can I wrap or chunk Base64 lines? +

Yes. Raw Base64 output can be left unwrapped or wrapped at 64, 76, or 120 characters per line. Data URI output stays unwrapped so the URI remains copy-ready.

Is my JSON uploaded when encoding or decoding? +

No. JSON to Base64 and Base64 to JSON both run entirely in your browser. Your data is never uploaded, stored, logged, or sent to a server.

Why encode JSON as Base64? +

To move JSON safely through channels that are not binary-safe or that treat certain characters specially — a URL query parameter, an HTTP header, a cookie, an environment variable, or a data URI. Base64 turns arbitrary text into a limited alphabet of letters, digits, and a couple of symbols that survive the trip without needing extra escaping.

Is Base64 encryption? Is my data secure? +

No, and this is important. Base64 is an ENCODING, not encryption. It provides zero security — anyone can decode it instantly with a single command, and no key is involved. Never use Base64 to hide passwords, tokens, or personal data. If you need secrecy, encrypt the data; Base64 only makes it transport-safe.

What is URL-safe Base64? +

Standard Base64 uses + and / characters, both of which have special meaning in URLs and get mangled when a link is copied or re-encoded. URL-safe Base64 substitutes - and _ instead, and usually drops the trailing = padding. Use it whenever the encoded value goes into a query string or a path — it is also what JWTs use.

How much bigger does Base64 make my JSON? +

About 33% larger, because every 3 bytes of input become 4 characters of output. That is the price of transport safety. If size matters, minify the JSON before encoding — stripping whitespace first means you are not paying the 33% overhead on characters that carry no information.