DevTools Hub

Guides › Base64, URL Encoding, HEX/ASCII and JWT Explained

Base64, URL Encoding, HEX/ASCII and JWT Explained

Encoding represents data in a different form. It is not encryption: anyone can reverse it. The goal is not secrecy but moving data safely through systems that accept only certain characters.

Base64

Base64 represents binary data with 64 characters: upper and lowercase letters, digits, + and /. It is used wherever binary data must travel through text-only channels: email attachments, images inside JSON, HTTP Basic auth, logged MQTT payloads.

How it works

  1. Group the input into 3 bytes (24 bits).
  2. Split the 24 bits into four 6-bit pieces.
  3. Map each 6-bit value (0-63) to a character: 0-25 → A-Z, 26-51 → a-z, 52-61 → 0-9, 62 → +, 63 → /
  4. If the last group is short, pad with =.
"Man"   → 4D 61 6E → 010011 010110 000101 101110 → T W F u → "TWFu"
"Hello" → "SGVsbG8="
"한"    → UTF-8 bytes ED 95 9C → "7ZWc"

URL encoding (percent-encoding)

URLs allow only a limited character set (RFC 3986). Other characters are written as their byte values in %XX form.

CharacterEncodedNotes
space%20 (+ in form submissions)Mixing the two causes frequent bugs
&%26Clashes with the query separator
=%3DClashes with the key/value separator
/%2FClashes with the path separator
é%C3%A9Each UTF-8 byte is encoded

In JavaScript use encodeURIComponent() for a single query value and encodeURI() for a whole URL. Encoding an already-encoded value produces double encoding such as %25C3....

HEX and ASCII

ASCII assigns numbers 0-127 to letters, digits, symbols and control characters. HEX writes each byte as two hexadecimal digits (00-FF). Viewing serial or Modbus traffic as HEX reveals invisible control characters exactly.

HEXCharHEXCharHEXChar
00NUL20space41A
02STX (start of text)3005AZ
03ETX (end of text)39961a
06ACK3A:7Az
0ALF (line feed)2C,7B / 7D{ / }
0DCR (carriage return)2E.22"
15NAK2D-7FDEL

JWT (JSON Web Token)

A JWT carries login state or permissions between systems (RFC 7519). It has three parts separated by dots.

xxxxx.yyyyy.zzzzz
Header.Payload.Signature
PartContentExample
HeaderToken type and signing algorithm{"alg":"HS256","typ":"JWT"}
PayloadClaims (the data){"sub":"user123","exp":1764403600}
SignatureHeader and payload signed with a keyDetects tampering

The header and payload are Base64URL-encoded JSON, so anyone can decode and read them. This site's JWT decoder shows them right in your browser without a server.

Registered claims

ClaimMeaning
issIssuer
subSubject (usually the user ID)
audAudience (the service meant to accept the token)
expExpiration time (Unix seconds)
nbfNot valid before this time
iatIssued at

Security notes

Encoding vs encryption vs hashing

KindReversiblePurposeExamples
EncodingBy anyoneFormat conversionBase64, URL encoding, HEX
EncryptionOnly with the keyConfidentialityAES, RSA
HashingNo (one-way)Integrity, password storageSHA-256, bcrypt
Error-detecting codeNot applicableDetect transmission errorsCRC

Tools: Base64 · URL encoder · HEX-ASCII · JWT decoder

Try it now: Base64 Encoder / Decoder (runs in your browser, no data is sent anywhere)