Base64, URL Encoding and JWTs: What They Are (and Why They're Not Encryption)

Open the Base64 Encoder / DecoderFree, no sign-up.

Base64, URL encoding and JWTs all turn readable text into something that looks scrambled, so people often assume they're secret. None of them is encryption: anyone can reverse them in a second. Here's what each one is for, with worked examples you can check yourself.

Base64: packaging data as safe text

Base64 turns any bytes into a string built from 64 characters that survive email systems, JSON and HTML: A to Z, a to z, 0 to 9, + and /, with = as padding at the end. Every 3 bytes become 4 characters, so the result is about a third bigger than the original. The rules are in RFC 4648.

TextBase64
HiSGk=
ParisUGFyaXM=
caféY2Fmw6k=
user:passdXNlcjpwYXNz

"café" needs more characters than you might expect because é takes 2 bytes in UTF-8. The last row is how HTTP Basic authentication sends a username and password, which is why RFC 7617 says Basic authentication isn't secure unless it runs over TLS (HTTPS): anyone who sees that header can decode it instantly.

There is also a variant called base64url, which swaps + for - and / for _ so the result is safe inside web addresses. Padding is often dropped. JWTs use this variant.

URL encoding: making text safe inside a link

Some characters have a job in a web address: ? starts the query, & separates parameters, # starts a fragment. To use them as ordinary text, you percent-encode them: each byte becomes % followed by two hexadecimal digits, as defined in RFC 3986.

  • A space becomes %20, & becomes %26, = becomes %3D, + becomes %2B and % itself becomes %25.
  • The search "Fish & Chips" becomes Fish%20%26%20Chips. Left unencoded, the & would split it into two parameters and the search would only see "Fish".
  • Non-English text is encoded byte by byte in UTF-8: "東京" (Tokyo) becomes %E6%9D%B1%E4%BA%AC, three bytes per character.

Encode the individual values, not the whole address. Encoding a full URL as if it were one value turns https:// into https%3A%2F%2F and breaks it. Also note that web forms traditionally send a space as + rather than %20, as MDN's reference explains, so you'll see both in the wild.

JWTs: three base64url parts joined by dots

A JSON Web Token, defined in RFC 7519, is a compact way for a server to hand you a signed statement such as "this is user 1234 and they may view reports". It has three parts separated by dots: header.payload.signature. Here is a complete example token, split into its parts for readability and signed with a made-up key:

  1. Header: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  2. Payload: eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlNhcmEiLCJyb2xlIjoidmlld2VyIiwiaWF0IjoxNzkwMDAwMDAwLCJleHAiOjE3OTAwMDM2MDB9
  3. Signature: wfEdMdRnWXrFLpWPEH2B0Np9vYEnku8nXaZY6tkm06E

Decoding the first two parts gives plain JSON:

  • Header: {"alg":"HS256","typ":"JWT"}, which names the signing algorithm.
  • Payload: {"sub":"1234567890","name":"Sara","role":"viewer","iat":1790000000,"exp":1790003600}, the claims.

The signature is calculated from the header and payload using a secret key (for HS256) or a private key (for algorithms such as RS256 and ES256). It is the only part that proves anything. Most JWTs start with eyJ, because that's how the start of a JSON object, {" followed by a letter, looks in Base64.

Reading exp, iat and nbf

JWT times are NumericDates: the number of seconds since 1 January 1970 UTC.

  • iat (issued at): 1790000000 is 21 September 2026, 14:13:20 UTC. That is 10:13:20 in New York (UTC−4 at that time of year) and 22:13:20 in Singapore (UTC+8).
  • exp (expires): 1790003600 is 3,600 seconds later, so this token is valid for one hour and must be rejected from 15:13:20 UTC.
  • nbf (not before): the token must not be accepted before this time.

The standard lets servers allow a small leeway, usually no more than a few minutes, for clocks that disagree. Once exp has passed, the server rejects the token, typically with a 401 error, which is why an app that worked in the morning can fail in the afternoon. Without our tools, run new Date(1790000000 * 1000).toISOString() in your browser's console, or date -u -d @1790000000 on Linux (date -u -r 1790000000 on macOS). A 13-digit value is in milliseconds, which isn't what the standard specifies, so something upstream has probably got it wrong. Our guide to Unix timestamps covers seconds, milliseconds and time zones in more depth.

Decoding is not verifying, so guard your tokens

Anyone holding a JWT can read its payload, so never put secrets in one. Anyone can also edit the payload, changing "viewer" to "admin", and re-encode it. What stops that working is the server checking the signature with its key, accepting only the algorithms it expects, and checking exp, nbf, the issuer and the audience. RFC 8725, the JWT best-practice document, describes libraries that accepted tokens with the algorithm set to "none" and so checked no signature at all.

A decoder shows what a token claims, not whether it's genuine. Encrypted JWTs (JWE) are different: they have five parts, and their contents can't be read without the key.

Be careful where you paste tokens, too. A valid access token works like a temporary password: whoever holds it can act as you until it expires. Pasting one into an online decoder that sends it to a server hands it over, so use a decoder that works locally, or test with an expired token. Treat tokens like passwords in tickets, screenshots and chat messages too. If one leaks, sign out of that session or ask the administrator to revoke it.

Using our tools

All three run in your browser, so nothing you paste is sent to our server.

Base64. In the Base64 Encoder / Decoder:

  1. Type text, or paste Base64, into the Input box.
  2. Tick URL-safe if you want - and _ with no = padding, as in JWTs.
  3. Click Encode or Decode, then Copy, or Use result as input to reverse it.

Decoding accepts both alphabets, adds missing padding and ignores line breaks and a data: prefix. Text is read as UTF-8; if the result isn't text, you get a Download the file link instead. To turn a picture into Base64, use Image to Base64.

URL encoding. In the URL Encoder / Decoder:

  1. Paste the text into Input.
  2. Under Encode as, choose A part of a URL for a search term or parameter value. It leaves only letters, digits and - _ . ~ unchanged. Choose A whole URL to tidy a complete address while keeping / ? & =.
  3. Click Encode or Decode. Keep Decode + as a space ticked for form data, and untick it if a plus should stay a plus.
  4. Click Split URL into parts to see the host, path, each query parameter and the fragment in a table.

JWTs. In the JWT Decoder:

  1. Paste the token into the JWT box. A "Bearer " prefix or surrounding quotes are removed for you, and it decodes as soon as all three parts are there, or you can click Decode.
  2. Read the table. It shows iat, exp and nbf as UTC dates, marks the token expired or still valid by your device's clock, and lists the issuer, subject and audience.
  3. Check the Header, Payload and Signature boxes. A token with the algorithm "none" gets a warning.

It doesn't verify the signature, and it can't open five-part encrypted tokens. To see a time in your own time zone, paste it into the Timestamp Converter. JWT payloads are JSON, so our JSON guide helps with reading them, and our guide to hashes covers SHA-256, the hash inside HS256.

Quick answers

Is Base64 a form of encryption?

No. It uses no key, and anyone can decode it instantly. RFC 4648 itself notes that it hides data from a casual glance but gives no confidentiality.

Can I change the data in a JWT?

You can edit and re-encode the payload, but the signature will no longer match, and a correctly configured server rejects the token.

What's the difference between %20 and + for spaces?

%20 is standard percent-encoding and means a space anywhere in a URL. + means a space only in form-style query strings; elsewhere it's a literal plus sign, which is why a real plus in a value must be sent as %2B.

Why do JWTs expire so quickly?

Because a stolen token works until it expires, short lifetimes limit the damage. Apps usually get a fresh one in the background with a separate refresh token.

Sources

  1. IETF: RFC 4648, The Base16, Base32, and Base64 Data Encodings
  2. IETF: RFC 3986, Uniform Resource Identifier (URI): Generic Syntax
  3. IETF: RFC 7519, JSON Web Token (JWT)
  4. IETF: RFC 8725, JSON Web Token Best Current Practices
  5. IETF: RFC 7617, The 'Basic' HTTP Authentication Scheme
  6. MDN Web Docs: encodeURIComponent()

Spotted a mistake or something out of date? Tell us and we'll fix it.

More guides