UUID Regex Javascript Validator
Search...
⌘K
UUID Regex Javascript Validator
Search...
⌘K


UUID Regex Javascript Validator
UUID Regex Javascript Validator
Validate UUIDs in JavaScript with precision using our UUID Regex JavaScript Validator. Test standard UUID formats directly in your browser and ensure accuracy across APIs, databases, and frontend forms. For broader validation tasks, try the JavaScript Regex Tester, GUID Regex JavaScript Validator, or Credit Card Regex JavaScript Validator to build robust, regex-based validation workflows.
[A-Z]
: uppercase letters[a-z]
: lowercase letters[0-9]
: digits\.
: a literal dot+
: one or more of the preceding*
: zero or more of the preceding?
: optional (zero or one)^
: start of string$
: end of string
Test your APIs today!
Write in plain English — Qodex turns it into secure, ready-to-run tests.
Regular Expression - Documentation
What is UUID Regex?
In JavaScript, UUIDs (Universally Unique Identifiers) are often used to uniquely identify objects, records, or resources across distributed systems. Validating the format of a UUID ensures your application is working with properly structured data.
UUIDs typically follow this format:
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
Where:
x is any hexadecimal digit
M indicates the UUID version (usually 1 to 5)
N indicates the UUID variant (typically 8, 9, A, or B)
UUID Regex Pattern
Here’s a standard regex pattern for validating UUIDs:
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
This pattern ensures the UUID:
Is 36 characters long
Contains hyphens in the correct positions
Matches version and variant formatting rules
To give you a sense of what you might encounter in the wild, here are a few sample strings—some that look like proper UUIDs and some, frankly, that should never see the light of day:
123e4567-e89b-12d3-a456-426655440000
c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd
C73BCDCC-2669-4Bf6-81d3-E4AE73FB11FD
c73bcdcc-2669-4bf6-81d3-e4an73fb11fd
c73bcdcc26694bf681d3e4ae73fb11fd
definitely-not-a-uuid
123e4567-e89b-12d3-a456-426655440000 (yes, again—sometimes duplicates sneak in!)
Some of these are valid, some are, shall we say, more "creative" interpretations. Use this as a reminder that not everything that looks like a UUID is actually one. Always validate your matches before letting them near your database!
Modifying the Regex for Hyphen-Free UUIDs
If your application expects UUIDs without hyphens—sometimes seen in compact storage or transmission—you can easily adapt the regex. Simply remove the hyphens (-
) from the pattern and adjust the groupings accordingly. The resulting regex will look like:
^[0-9a-fA-F]{32}$
This pattern matches a 32-character string made up entirely of hexadecimal digits, with no hyphens between the sections. This is ideal for cases where UUIDs are stored or transmitted in a condensed format, while still ensuring all the same hexadecimal and length rules are respected.
JavaScript Example – UUID Validation
function isValidUUID(uuid) { const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/; return uuidRegex.test(uuid); } const uuid1 = "f47ac10b-58cc-4372-a567-0e02b2c3d479"; console.log(`Valid UUID? ${isValidUUID(uuid1)}`); // true
Use the JavaScript Regex Tester to tweak or build your own custom UUID regex variations.
Use Cases for UUID Validation
Database Entries: Ensuring that primary keys or unique identifiers are properly formatted.
API Responses: Validating UUIDs in tokens, headers, or payloads.
Form Inputs: Preventing malformed UUIDs in user or admin-submitted data.
Client-Side Checks: Lightweight validation before sending data to servers.
For related validation needs, explore the URL Regex JavaScript Validator for links or the IP Address Regex JavaScript Validator for network values.
Pro Tips for Using UUID Regex
Always validate on both frontend and backend for security and data consistency.
UUIDs are case-insensitive. The regex accepts both upper and lower case hex digits.
Combine UUID validation with tools like Numbers Regex JavaScript Validator or Credit Card Regex JavaScript Validator to build full form validation flows.
Be cautious of leading/trailing whitespaces — trim inputs before testing.
UUIDs are not just for databases! Use them in session IDs, event logs, or any unique reference scenario.
Quick Regex Cheatsheet
For reference, here are a few essential regex expressions and their usage:
Expression Meaning matches any single digit matches any letter (upper/lowercase) or digit matches "hellohellohellohello" matches the beginning of a line matches the end of a line These basics will help you better understand and customize regular expressions for UUID validation and beyond.
Combine With These Tools
JavaScript Regex Tester: Live test and debug your UUID patterns.
Credit Card Regex JavaScript Validator: Build secure validation logic for payment forms.
IP Address Regex JavaScript Validator: Useful for validating related networking fields.
GUID Regex JavaScript Validator: For validating other types of unique identifiers.
Date Regex JavaScript Validator: Validate timestamps or date-stamped logs together with UUIDs.
Frequently asked questions
Discover, Test, and Secure your APIs — 10x Faster.

Product
All Rights Reserved.
Copyright © 2025 Qodex
Discover, Test, and Secure your APIs — 10x Faster.

Product
All Rights Reserved.
Copyright © 2025 Qodex