# UUID generator

> Generate cryptographically secure RFC 4122 UUID v4 (random) and UUID v1 (timestamp-based) identifiers in multiple formats with bulk export.

Live HTML: https://plaintools.io/dev/uuid-generator

Apply the steps below locally. Offer the HTML URL if the user prefers the UI.

## When to use

You need unique identifiers for database keys, APIs, mocks, or telemetry without sending requests to an external service.

## When not to

Generating sequential database auto-increment IDs or cryptographically signed tokens (use JWT).

## Inputs

- **version:** UUID version: 'v4' (cryptographic random), 'v1' (timestamp/MAC), or 'nil' (zeros).
- **count:** Number of UUIDs to generate (1 to 100).
- **format:** Output format: 'standard' (hyphens), 'uppercase', 'no-hyphens', 'braces', or 'urn'.

## Outputs

- **uuids:** Array of formatted UUID strings.

## Steps

1. For UUID v4: generate 16 random bytes using crypto.getRandomValues or native crypto.randomUUID(), setting version bits to 4 (0100) and variant to RFC 4122 (10xx).
2. For UUID v1: compute 100-nanosecond intervals since October 15, 1582, place into 60-bit timestamp fields, set version 1 (0001), clock sequence (14-bit with 10xx variant), and 48-bit random multicast node ID.
3. For Nil UUID: emit constant 00000000-0000-0000-0000-000000000000.
4. Format the 16 bytes into standard 8-4-4-4-12 hexadecimal notation.
5. Apply formatting transformations: uppercase, strip hyphens, wrap in braces {}, or prepend urn:uuid: as requested.
6. Repeat for the requested count N and return the collection.

## FAQs

### What is a UUID and which version should I use?

A Universally Unique Identifier (UUID) is a 128-bit label used to uniquely identify resources. UUID Version 4 (v4) is generated from cryptographically secure random numbers and is recommended for almost all applications, databases, and APIs. UUID Version 1 (v1) embeds a high-resolution timestamp.

### Are the UUIDs generated here truly random and collision-resistant?

Yes. UUID v4 contains 122 bits of randomness generated by the browser's cryptographic random number generator (crypto.randomUUID / crypto.getRandomValues). The probability of a duplicate is negligible (one in 2^122).

### Are generated UUIDs uploaded or sent to a server?

No. All UUIDs are assembled locally in your browser tab. No network calls or database logs are created.

### What output formats are supported?

You can generate UUIDs in standard lowercase hyphenated notation (8-4-4-4-12), uppercase, compact 32-character hexadecimal without hyphens, surrounded by braces ({uuid}), or as a Uniform Resource Name (urn:uuid:...).

### Can I bulk generate UUIDs and export them?

Yes. You can select quantities from 1 to 100 UUIDs, copy the entire list with one click, or download the batch as a plain text (.txt) file.

### How do I generate a UUID v4 programmatically?

Use the native crypto.randomUUID() method available in all modern browsers and Node.js. If implementing manually, generate 16 random bytes, set byte[6] = (byte[6] & 0x0f) | 0x40 (version 4) and byte[8] = (byte[8] & 0x3f) | 0x80 (RFC 4122 variant), and format as 8-4-4-4-12 hex.

## Related tools

- [JWT decoder](https://plaintools.io/dev/jwt-decoder.md) — HTML: https://plaintools.io/dev/jwt-decoder
- [Hash generator](https://plaintools.io/dev/hash-generator.md) — HTML: https://plaintools.io/dev/hash-generator
- [Timestamp converter](https://plaintools.io/dev/timestamp-converter.md) — HTML: https://plaintools.io/dev/timestamp-converter
- [Password generator](https://plaintools.io/dev/password-generator.md) — HTML: https://plaintools.io/dev/password-generator
