TR

Home / Guides / What Are JSON, Base64 and URL Encoding? Encoding vs Encryption vs Hashing

What Are JSON, Base64 and URL Encoding? Encoding vs Encryption vs Hashing

Updated: November 6, 2026 · AracMerkezi

▶ Open JSON Formatter / Minifier

When you develop software, JSON, Base64, URL encoding, HTML entities, SHA, JWT and regular expressions (regex) keep coming up. Most mistakes come from mixing up what each one is for: one carries data, one converts it to safe characters, one produces a fingerprint. This guide shows each with a single example; the outputs of the examples were verified by actually running them.

First, the distinction: encoding, encryption, hashing

ConceptPurposeReversible?Example
EncodingMake data portable to another environmentYes, no key neededBase64, URL encoding
EncryptionHide the dataYes, but only with a keyAES
Hash (digest)Produce a fingerprint of the dataNo, one-waySHA-256

The rule: use encryption when you need secrecy, a hash when you need an integrity check, and encoding when you need portability. Mistaking Base64 for “encryption” is the most common security error.

JSON

JSON is a lightweight data format made of key-value pairs and is the most common format in APIs. {"ad":"Ayşe","yas":30} is 22 characters on one line; formatting it with indentation makes it readable but increases the size. Double quotes are mandatory; a trailing comma ({"a":1,}) and an unquoted key ({a:1}) are invalid. For details see the What is JSON guide.

Base64

Base64 represents binary data using only letters, digits and a few symbols. Every 3 bytes become 4 characters, so the size grows by about one third. Merhaba (7 bytes) becomes TWVyaGFiYQ== (12 characters). The trailing = signs are padding. Turkish characters are first converted to UTF-8: Çay is 4 bytes and becomes w4dheQ==. No key is needed to decode it; Base64 provides no secrecy. In addresses and inside a JWT, the Base64URL variant is used, which uses - and _ instead of + and /. For a similar encoding see the Base32 vs Base64 guide.

URL encoding

Spaces, Turkish letters and characters such as &, ? and = cannot be used directly in addresses; they are converted to percent codes. In JavaScript, encodeURIComponent("çay & şeker=2") gives %C3%A7ay%20%26%20%C5%9Feker%3D2. Since each Turkish letter is two bytes, it turns into two %XX groups. Encode the parts, not the whole address: if you put the whole address https://x.com/a b?q=çay through component encoding, the : and / characters are broken too. The URL Parser helps you see the parts of an address.

HTML entities

In HTML, the characters <, > and & can be interpreted as markup. To display them as text, &lt;, &gt; and &amp; are used. Escaping user input when writing it into a page is the basic step for preventing script injection (XSS).

SHA hash

SHA produces a one-way fingerprint of a text. The SHA-256 digest of the text abc is ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. If you change one letter and write abd, the digest comes out completely different (a52d159f…). MD5 and SHA-1 are considered weak against collision attacks; for new work SHA-256 and above is preferred. SHA alone is not enough to store passwords; you need a deliberately slow, salted password hashing algorithm. For details see the What is a hash guide.

JWT

A JWT has three parts separated by dots: header, payload and signature. The first two parts are JSON encoded with Base64URL and are readable once decoded; that is, the content is not secret. Only the server should verify the signature. For an in-depth explanation see the What is a JWT guide.

Regular expressions (regex)

Used to search for patterns in text. The expression "fiyat 12 ve 345 TL".match(/\d+/g) returns 12 and 345; \d+ matches one or more digits. Regex engines can differ slightly between languages. For a thorough introduction there is the Regex guide.

Size math: how much does Base64 inflate?

The size formula is simple: n bytes become 4 × ceil(n / 3) characters. 1,000 bytes become 1,336 characters, and a small image of 30,000 bytes (about 30 KB) becomes 40,000 characters. So an image embedded in a page with Base64 is about one third heavier than uploading it as a file, and the browser cannot cache it separately. For small icons the cost is acceptable; for large images, serving a file is more efficient.

Example: the journey of a request

Imagine a user types çay & şeker into a search box. The browser or your code runs the query value through URL encoding and sends it as q=%C3%A7ay%20%26%20%C5%9Feker; if the & were not encoded, the server would take it as the start of a new parameter. The server returns the results as JSON: {"q":"çay & şeker"}. When the page writes this text to the screen it applies HTML escaping and the & becomes &amp;, so special characters inside the text are not treated as markup. If the same request needs credentials for the API, the basic authentication header turns the text user:password into Base64: the value ali:1234 becomes YWxpOjEyMzQ=. This value is not a password protection; only protecting the connection with TLS makes it safe. In the chain, four different tools solved four different problems, and none replaces another.

The order to follow when debugging

If data has been corrupted, proceed in this order: first write down which form the text is in at each stage (raw, JSON, URL encoded, Base64). Then apply the inverse at each stage to recover the previous form. If Turkish characters are being garbled, there is almost always a character encoding (UTF-8) mismatch; double encoding shows up as %25 sequences.

Which one for which situation?

NeedRight tool
Exchanging data with an APIJSON
Embedding an image or binary data in textBase64
Putting Turkish text in a query parameterURL encoding (part by part)
Safely displaying user text in HTMLHTML entity escaping
Verifying a downloaded file is intactSHA-256
Carrying session information with a signatureJWT
Finding a pattern in textRegex

Common mistakes

Privacy

The tools on this site process your data in your browser. Even so, avoid pasting real keys, passwords and tokens from live systems into sites you do not trust. Rotating a key you shared by accident is the most reliable step after a leak, so do your experiments with sample data.

Tools: JSON Formatter, Base64, URL Encode/Decode, HTML Entity, SHA Hash, JWT Decoder, Regex Test and JSON ↔ CSV.

Frequently asked questions

Is Base64 encryption?

No. Base64 is only encoding; it can be decoded without a key. Use encryption for secrecy.

Is the content of a JWT secret?

No. The header and payload are Base64URL encoded and are readable once decoded; do not put sensitive information in them.

Is the whole address encoded in URL encoding?

No. Only parts such as query parameter values are encoded; if the whole address is encoded, the colon and slashes are broken too.

Tools mentioned in this guide

More guides

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.