use case
How to validate whether a string is a valid UUID
Check if an ID from an API response or user input matches the UUID format.
APIs, databases, and user inputs sometimes pass values that are supposed to be UUIDs but contain typos, extra characters, or wrong formats. Validating the format before processing the ID prevents confusing downstream errors. This guide shows how to check any string against the UUID v1–v5 format and identify the version.
Step-by-step guide
- Copy the string to validate: Copy the identifier from the API response, URL parameter, database field, or user input you want to check.
- Paste into the validate field: Paste the string into the 'validate' input of the UUID Generator. The tool checks it against the RFC 4122 regex for versions 1–5 and reports is_valid: true or false.
- Read the version: The validated_version field shows which UUID version the string is (v1–v5). If is_valid is false, the string is not a UUID — check for missing hyphens, wrong length, or non-hex characters.
Frequently asked questions
- Does the validator check the UUID content, or just the format?
- Format only. Validation confirms the string matches the 8-4-4-4-12 hex pattern with a valid version digit (1–5) and variant bits. It cannot confirm that the UUID was actually generated by a trusted source — for that, you need a token or signature scheme.
- What if my UUID is in compact format (no hyphens)?
- The validator accepts both hyphenated and compact (32 hex chars, no hyphens) formats. Compact UUIDs are checked by inserting the hyphens at the correct positions before pattern matching.
Try it now
Use the UUID Generator to complete this task — free, no sign-up, runs in your browser.
Open UUID Generator →