ContextCleaner: see every entry in the Windows 11 right-click menu, and which app added it — on the Microsoft Store.
Guide PrismKit

Developer Encoding and Formats: JSON, Base64, URL Encoding, JWTs, Timestamps and Colors

The encodings developers meet daily, explained: JSON errors, Base64 and Base64url, URL encoding, HTML escaping, JWTs, timestamps, UUIDs and colors.

Published October 28, 2026 12 min read

Most “garbled data” bugs come from mixing up a handful of formats. JSON must use double quotes and allows no comments or trailing commas. Base64 turns bytes into text and makes data about a third larger; Base64url swaps two characters so the result is safe in URLs and file names. URL encoding writes a space as %20 in a path but as + in form data. HTML escaping protects &, < and quotes in markup. A JWT is three Base64url parts, and decoding one does not verify it. Unix timestamps come in seconds or milliseconds, and mixing them gives you dates in 1970 or far in the future. Identify the format first, then decode or convert it with a tool you trust, ideally one that runs offline so tokens and data stay on your machine.

This guide explains each of these formats, the mistakes that cause common errors, and how to debug a string you do not recognise. Each section links to a deeper guide on this site, and the facts come from the relevant standards: RFC 8259 for JSON, RFC 4648 for Base64, RFC 3986 and the WHATWG URL Standard for URLs, RFC 7519 for JWTs and RFC 9562 for UUIDs.

JSON: why JSON.parse says “Unexpected token”

JSON looks like JavaScript, but RFC 8259 defines a much stricter grammar. The common errors in JSON.parse almost always come from one of these:

You seeLikely causeFix
Unexpected token < at position 0The response is HTML, often an error page or a login redirectCheck the status code and content type before parsing
Unexpected token 'Single quotes around keys or stringsUse double quotes
Unexpected token } or ]A trailing comma before the closing bracketRemove the last comma
Unexpected token /A commentJSON has no comments; remove them or use a format that allows them
Unexpected end of JSON inputEmpty or cut-off bodyCheck that the request returned content

Numbers and precision

RFC 8259 warns that numbers are usually handled as IEEE 754 double precision values, so implementations may not keep more precision or range than that. In JavaScript, the largest integer that is exactly safe is 9,007,199,254,740,991 (Number.MAX_SAFE_INTEGER). Large IDs, such as 64-bit database keys, can silently change when parsed as numbers. Send them as strings instead. JSON.parse unexpected token errors explained goes through each message.

Two quieter problems

RFC 8259 says names within an object SHOULD be unique, but it does not say which value wins when they are not, so different parsers can disagree about a key that appears twice. It also says implementations must not add a byte order mark to JSON sent over a network, while parsers may ignore one. A file saved “with BOM” by an editor can therefore parse in one tool and fail with an unexpected token in another. Save JSON as UTF-8 without a BOM.

Formatting and validating

A formatter turns one long line into an indented tree, which makes a missing bracket or a wrong nesting level obvious. A validator tells you the exact position of the first error. Both are worth running before you assume the bug is in your code.

Base64 and Base64url

Base64, defined in RFC 4648, encodes every 3 bytes as 4 characters from a 64-character alphabet, with = padding at the end when needed. That is why Base64 output is about one third larger than the input. It is an encoding, not encryption: anyone can decode it.

The standard alphabet includes + and /, which have special meanings in URLs and file paths. RFC 4648 section 5 defines the URL and filename safe alphabet, usually called Base64url, which uses - and _ instead. Padding is often left off in Base64url, for example in JWTs.

Telling them apart

  • Contains + or /: standard Base64.
  • Contains - or _: Base64url.
  • Length not a multiple of 4 and no =: probably unpadded Base64url. Add = until the length is a multiple of 4 before decoding with a strict decoder.

URL encoding: %20 or +?

Both are right, in different places. RFC 3986 defines percent-encoding: a byte that is not allowed in part of a URL is written as % followed by two hexadecimal digits, so a space becomes %20. HTML forms use a different format, application/x-www-form-urlencoded, described in the WHATWG URL Standard, where a space becomes + in the query string.

ContextSpace becomesExample
URL path%20/files/annual%20report.pdf
Query string from a form+?q=annual+report
JavaScript encodeURIComponent%20annual%20report

The common bug is decoding + as a literal plus in a path, or encoding a real + in a query value without escaping it, so the server reads it as a space. In JavaScript, encodeURIComponent is the right function for a single value; encodeURI leaves reserved characters such as ? and & alone because it expects a whole URL. URL encoding spaces: %20 vs + explained covers the edge cases.

HTML escaping: which characters need it?

In HTML text, two characters must be escaped: & as &amp; and < as &lt;. Escaping > as &gt; is common and harmless. Inside attribute values, also escape the quote character you used around the value: &quot; for double quotes, and &#39; for single quotes. Escaping depends on context: text, attributes, URLs and scripts each have their own rules, and escaping a string for one does not make it safe in another. Most templating systems escape text for you, and the bugs usually come from building HTML by hand with string concatenation.

Named and numeric entities

Entities come in two forms. Named entities such as &copy; are easier to read. Numeric entities such as &#169; (decimal) or &#xA9; (hexadecimal) work for any character, including ones without a name. If your file is saved as UTF-8 and served with the right charset, you can type most characters directly and only escape the few that have a special meaning in HTML.

Which characters need escaping in HTML? lists named and numeric entities.

JWTs: decoding is not verifying

A JSON Web Token, defined in RFC 7519, is usually three Base64url parts separated by dots: a header that names the algorithm, a payload of claims, and a signature. Decode the first two parts and you can read the claims, such as sub (subject), exp (expiry) and iat (issued at), which are Unix timestamps in seconds.

Three points cause most confusion:

  • The payload is not encrypted in a signed JWT. Anyone holding the token can read it, so do not put secrets in it.
  • Decoding does not prove anything. Only verifying the signature with the right key shows the token was issued by who you think and has not been changed.
  • Unsecured tokens exist. RFC 7519 describes unsecured JWTs with alg set to none. A server should never accept these unless it was deliberately designed to.

Because a token can grant access to an account, paste it only into tools you trust. An offline decoder keeps live tokens off third-party websites. Decode a JWT offline on Windows without a website shows how.

Unix timestamps: seconds vs milliseconds

A Unix timestamp counts time since midnight UTC on January 1, 1970. Most systems and JWT claims count in seconds; JavaScript’s Date counts in milliseconds, as MDN’s documentation describes. For present-day dates a seconds value has 10 digits and a milliseconds value has 13.

SymptomCauseFix
A date in January 1970Seconds treated as millisecondsMultiply by 1000
A date thousands of years aheadMilliseconds treated as secondsDivide by 1000
Times off by whole hoursLocal time and UTC mixedStore UTC, convert for display

Unix timestamp seconds vs milliseconds: 1970 date fix explains the conversions in common languages.

UUIDs and hashes

UUIDs

RFC 9562, which replaced RFC 4122, defines the current UUID versions. Version 4 is random and is the usual default. Version 7 starts with a Unix epoch timestamp in milliseconds, so values sort roughly by creation time, which suits database keys. A UUID is an identifier, not a secret; do not use one as a password or access token.

Hashes

A hash such as MD5 or SHA-256 turns any input into a fixed-length fingerprint. It is a one-way function, not encryption. RFC 6151 explains that MD5 is no longer acceptable where collision resistance is needed, such as digital signatures, so use SHA-256 for integrity checks. Hashes are also not suitable for storing passwords on their own; use a dedicated password hashing function such as Argon2, scrypt or bcrypt.

Colors: HEX, RGB and HSL

CSS colors can be written in several equivalent ways, all defined in the CSS Color specification:

  • HEX: #1E90FF, two hexadecimal digits each for red, green and blue.
  • RGB: rgb(30 144 255), the same three channels as numbers from 0 to 255.
  • HSL: hsl(210 100% 56%), hue in degrees, then saturation and lightness, which is easier to adjust by hand.

HEX and RGB are exact conversions of each other. HSL conversions involve rounding, so a round trip can shift a value by one. Convert HEX to RGB and HSL: formulas and a worked example shows the maths.

How do I debug a string I do not recognise?

  1. Look at the characters. Only 0 to 9 and a to f suggests hex or a hash; letters, digits, + and / with = at the end suggests Base64; - and _ suggests Base64url.
  2. Count the dots and the length. Two dots and three Base64url parts is probably a JWT. 10 or 13 digits is probably a timestamp. 36 characters with hyphens in an 8-4-4-4-12 pattern is a UUID.
  3. Decode one layer at a time. Data is often encoded twice, such as JSON inside Base64 inside a URL parameter. Undo the outer layer first.
  4. Validate the result. If you expect JSON, run it through a validator to find the first error.
  5. Keep secrets local. Use an offline tool for tokens, keys and customer data, and never paste them into a website you do not control.

How PrismKit fixes this

PrismKit is a keyboard-first, offline toolkit for Windows that puts these conversions one hotkey away. Its Microsoft Store listing describes:

  • Formatters and validators: JSON, XML, SQL and HTML.
  • Encoders and decoders: Base64, URL encoding, JWT inspection and HTML entities.
  • Generators: UUIDs, hashes including MD5 and SHA, and Lorem Ipsum text.
  • Converters: HEX, RGB and HSL colors, epoch timestamps and text casing.
  • Testing tools: a regex tester and word counter.
  • Command palette: 36 tools reached from a hotkey and filtered as you type.
  • Private by design: 100% offline, with no tracking.

The core tools are free, and the listing also offers optional paid expansion packs.

PrismKit is free on the Microsoft Store.

Get PrismKit from the Microsoft Store

Frequently asked questions

Is Base64 a form of encryption?

No. It is an encoding that anyone can reverse. Use real encryption for anything secret.

Why does my JWT decode but my server rejects it?

Decoding only reads the parts. The server also checks the signature, the expiry (exp) and other claims, and any of those can fail.

How can I tell if a timestamp is in seconds or milliseconds?

For present-day dates, 10 digits means seconds and 13 digits means milliseconds. A date in 1970 usually means seconds were read as milliseconds.

Should a space in a URL be %20 or +?

Use %20 in paths and in values encoded with encodeURIComponent. A + means a space only in form-encoded query strings.

Is MD5 safe to use?

Not where collision resistance matters, such as signatures. It can still serve as a quick non-security checksum. Use SHA-256 for integrity checks.