Home / UUID Generator / Python

UUID Generator for Python

Generate a UUID right here, or copy the exact Python code to generate one yourself with the standard library's built-in uuid module. No install required.

100% client-side No account, no sign-up Python’s uuid module, standard library only

UUID Generator for Python

Click Generate to create one.

Generate a UUID in Python

Python’s standard library has UUID generation built in, no pip install needed. This is the same version-4 (random) UUID format the tool above produces.

import uuid

# Version 4 (random) — the most common choice
new_id = uuid.uuid4()
print(new_id)
# e.g. 550e8400-e29b-41d4-a716-446655440000

# As a plain string, if your code needs it without dashes
print(new_id.hex)

For version 5 (deterministic, namespace-based) UUIDs in Python, use uuid.uuid5(uuid.NAMESPACE_DNS, "example.com") instead.

How this tool works

Python’s uuid module is part of the standard library (no third-party dependency). uuid.uuid4() calls os.urandom() internally, which draws from the operating system’s cryptographically secure random source, the same category of mechanism as this page’s own browser-based generator, which uses the Web Crypto API’s crypto.randomUUID().

Sources:

Frequently asked questions

Do I need to install anything to generate a UUID in Python?

No. The uuid module ships with every standard Python installation. No pip install required.

uuid4() vs uuid1(): which should I use?

uuid4() is fully random and the standard default choice. uuid1() embeds a timestamp and the host’s MAC address, which can leak information about when and where the ID was generated. Avoid it unless you specifically need that behavior.