Home/UUID & GUID Length
Reference · RFC 9562 · Free checker

UUID & GUID Length

How many characters, bytes and bits a UUID has — in every format, version and database — plus a free length checker and a short-ID generator.

Quick answer: a UUID is 36 characters long in its standard form (32 hexadecimal digits plus 4 hyphens, grouped 8-4-4-4-12). Without hyphens it is 32 characters. In binary it is 16 bytes, which is 128 bits. A GUID is the same size.

Check a UUID’s length

Need a shorter ID? Generate one by length

These are random IDs, not UUIDs. They are made with your browser’s cryptographic random generator and never leave your device. If an ID must be globally unique, use a full UUID v4 instead.

How many characters are in a UUID?

The UUID length you will see almost everywhere is 36 characters. That standard text form, defined in RFC 9562, has 32 hexadecimal digits split into five groups by four hyphens: 8-4-4-4-12.

The math is simple. A UUID holds 128 bits. Each hex digit stores 4 bits, so you need 128 ÷ 4 = 32 digits. Add the 4 hyphens and you get 36. Example: f47ac10b-58cc-4372-a567-0e02b2c3d479.

Remove the hyphens and the same UUID is 32 characters. Nothing is lost — the hyphens only make it easier to read.

UUID size in bytes and bits

Stored as raw binary, every UUID is exactly 16 bytes (128 bits). The text form takes more space: 36 bytes as a plain ASCII string, more than twice the binary size.

Not all 128 bits are random. A few bits are reserved to mark the version and variant:

  • UUID v4 has 122 random bits (4 version bits and 2 variant bits are fixed).
  • UUID v7 has a 48-bit Unix timestamp in milliseconds and 74 random bits.
  • UUID v1 and v6 use a 60-bit timestamp, a 14-bit clock sequence and a 48-bit node ID.

UUID length in every format

The same 128-bit value can be written in several ways. Here is how long each one is:

FormatLengthExample
Standard (with hyphens)36 charactersf47ac10b-58cc-4372-a567-0e02b2c3d479
No hyphens (hex)32 charactersf47ac10b58cc4372a5670e02b2c3d479
With braces (GUID style)38 characters{f47ac10b-58cc-4372-a567-0e02b2c3d479}
URN45 charactersurn:uuid:f47ac10b-58cc-4372-a567-0e02b2c3d479
Base64 (with padding)24 charactersends with ==
Base64 / Base64URL (no padding)22 charactersURL-safe, still holds all 128 bits
Base62 or Base58up to 22 charactersletters and digits only
Decimal integerup to 39 digitsthe largest value is 2128−1
Binary16 bytesbest for database storage
Re-encoding is not the same as cutting. Base64, Base62 and Base58 make a UUID shorter while keeping every bit, so it stays unique and can be converted back. Simply chopping characters off a UUID throws bits away and makes duplicates far more likely.

Which characters are valid in a UUID?

A UUID uses only the digits 0-9, the letters a-f and hyphens in fixed positions (after characters 8, 12, 16 and 20). Letters are case-insensitive: RFC 9562 recommends lowercase output but says uppercase must be accepted on input.

Any other letter (such as g or z), a space, or a hyphen in the wrong place makes the value invalid. You can check any value with the UUID validator or the length checker above.

Does UUID length change by version?

No. Every UUID version is the same length: UUID v1, v4, v5, v6, v7 and v8 are all 36 characters and 16 bytes. Only the meaning of the bits changes. The special Nil and Max UUIDs are 36 characters too: 00000000-0000-0000-0000-000000000000 and ffffffff-ffff-ffff-ffff-ffffffffffff.

You can tell versions apart by the first digit of the third group (the 15th character when you count the hyphens), which is the version number. For example, it is always 4 in a UUID v4 and 7 in a UUID v7.

GUID length in C# and .NET

A GUID is Microsoft’s name for a UUID, so it has the same 16-byte size. Its text length depends on the format you pass to Guid.ToString():

C#
var g = Guid.NewGuid(); g.ToString(“D”).Length; // 36 (default, with hyphens) g.ToString(“N”).Length; // 32 (no hyphens) g.ToString(“B”).Length; // 38 {with braces} g.ToString(“P”).Length; // 38 (with parentheses) g.ToString(“X”).Length; // 68 (hex groups) g.ToByteArray().Length; // 16 bytes

If you see the error “Byte array for GUID must be exactly 16 bytes long”, the byte array you passed to new Guid(byte[]) is the wrong size. A GUID always needs exactly 16 bytes, and you cannot make one longer or shorter. Need one right now? Use the GUID generator.

How much space a UUID takes in a database

DatabaseRecommended typeSize
PostgreSQLnative uuid16 bytes
MySQL 8.0+BINARY(16) with UUID_TO_BIN()16 bytes (vs 36 characters for CHAR(36))
SQL Serveruniqueidentifier16 bytes
OracleRAW(16)16 bytes

Storing UUIDs as text works, but binary is less than half the size and makes indexes smaller and faster. See the MySQL UUID guide and the PostgreSQL UUID guide for full examples.

Checking UUID length in code

Python
import uuid u = uuid.uuid4() len(str(u)) # 36 len(u.hex) # 32 len(u.bytes) # 16
Java
UUID u = UUID.randomUUID(); u.toString().length(); // 36
JavaScript
crypto.randomUUID().length; // 36 crypto.randomUUID().replace(/-/g, ”).length; // 32

More examples are in the Python, Java and JavaScript guides.

Can a UUID be shorter? 8, 12 and 16-character IDs

A real UUID cannot be shorter than 128 bits. When people ask for an “8-character UUID”, they really want a short random ID. That is fine for things like invite codes or short links, as long as you understand the risk of duplicates.

The fewer characters you use, the sooner two IDs will clash. An 8-character hex ID has only about 4.3 billion possible values. You reach a 50% chance of a duplicate after roughly 77,000 IDs. A full UUID v4 needs about 2.7 quintillion IDs for the same risk.

  • Keep all 128 bits but shorten the text: encode the UUID in Base64URL or Base62 (22 characters).
  • Need a short random ID: use at least 16 Base62 characters for public IDs. NanoID’s default is 21 characters, which gives about 126 random bits.
  • Need guaranteed uniqueness: use a full UUID.

The generator at the top of this page shows the randomness and duplicate risk for each length as you change it.

Is there a minimum or maximum UUID length?

No. A standard UUID is always exactly 128 bits, so there is no minimum or maximum. The only thing that changes is how you write it: 32 to 45 characters as text, 22 to 24 as Base64, or 16 bytes as binary. A value of any other size is not a valid UUID.

Frequently asked questions

A UUID is 16 bytes (128 bits) in binary. As a standard text string it is 36 characters, which is 36 bytes in ASCII.

The standard form is always 36 characters. The same UUID can also be written as 32 characters without hyphens, 38 with braces, 45 as a URN or 22 in Base64URL. All of these hold the same 128-bit value.

In the standard format, 36 characters. If your system adds braces it is 38, and with the urn:uuid: prefix it is 45. A VARCHAR(36) column is enough for the standard form.

A GUID is 16 bytes, the same as a UUID. In C# the default text form is 36 characters, 32 with the “N” format and 38 with braces.

24 characters with padding, or 22 characters without it. Base64URL without padding is 22 characters and is safe to use in URLs.