<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 6.0.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/UUID",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4UUIDV"
  },
  "title" : "UUID"
}
-->

# UUID

A universally unique value to identify types, interfaces, and other items.

```
struct UUID
```

## Topics

### Creating UUIDs

[`init()`](/documentation/Foundation/UUID/init())

Creates a UUID with RFC 4122 version 4 random bytes.

[`init(uuid:)`](/documentation/Foundation/UUID/init(uuid:))

Creates a UUID from the uuid C-language structure.

[`init(uuidString:)`](/documentation/Foundation/UUID/init(uuidString:))

Creates a UUID from a string representation.

### Getting UUID Values

[`uuid`](/documentation/Foundation/UUID/uuid)

Returns the UUID as bytes.

[`uuidString`](/documentation/Foundation/UUID/uuidString)

Returns a string created from the UUID, such as “E621E1F8-C36C-495A-93FC-0C247A3E6E5F”

### Comparing UUIDs

### Using Reference Types

[`NSUUID`](/documentation/Foundation/NSUUID)

A universally unique value that can be used to identify types, interfaces, and other items.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`EntityIdentifierConvertible`](/documentation/AppIntents/EntityIdentifierConvertible)

[`ReferenceConvertible`](/documentation/Foundation/ReferenceConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Decodable`](/documentation/Swift/Decodable)

[`Sendable`](/documentation/Swift/Sendable)

[`Copyable`](/documentation/Swift/Copyable)

[`Escapable`](/documentation/Swift/Escapable)

[`Encodable`](/documentation/Swift/Encodable)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVAttachmentValueRepresentable`](/documentation/CoreVideo/CVAttachmentValueRepresentable)

[`Comparable`](/documentation/Swift/Comparable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)