Using UUIDs in URLs and Filenames
Things to watch out for when placing UUIDs in URL paths or filenames, plus shorter alternatives.
Can you use them as-is?
A standard UUID contains only hyphens and hexadecimal digits, so you can drop it straight into a URL or filename with no encoding needed. That said, its 36 characters make paths long and cluttered, and the brace-wrapped GUID form has to be encoded as %7B/%7D in a URL, so it's best avoided.
Making it shorter
If link length matters, use the 32-character hyphen-free form, or consider a 26-character ULID or a 21-character NanoID as an alternative. Both ULID and NanoID use only URL-safe characters, so they're safe without any encoding.
Case and slugs
UUIDs are case-insensitive, but URL comparisons can be case-sensitive, so it's safest to normalize everything to lowercase. When you need a human-readable slug, keep the UUID as an internal key only and pair it with a separate, human-friendly slug.