mkid
A tiny Rust-based CLI tool to generate unique IDs, primarily UUIDs. Built as a more capable alternative to uuidgen, with support for all UUID versions (v1-v8), multiple output formats, and clipboard integration.
Features
- Quick shortcuts:
mkid4andmkid7for instant UUID generation - All UUID versions supported: v1 through v8
- Smart defaults:
mkidgenerates UUID v7 (sortable, database-friendly) - Multiple formats: hyphenated, simple, URN, braced
- Case control: lowercase (default) or uppercase
- Clipboard integration: Copy output directly to clipboard
- Bulk generation: Generate multiple UUIDs at once
- Fast and lightweight: Three small binaries, minimal dependencies
Installation
With cargo-binstall (recommended)
The fastest way to install pre-built binaries:
From GitHub releases
Download pre-built binaries directly from GitHub releases.
From crates.io
Build from source via crates.io:
From source
Build from the repository:
Usage
Quick Shortcuts
For maximum convenience, use the shortcut commands:
# UUID v4 (random) - fastest way
# Output: 18431fda-68f1-42af-9318-1ece3d60281e
# UUID v7 (sortable) - fastest way
# Output: 019c1064-a92c-74f0-98d9-03496f8a9693
Basic Usage
Generate a UUID v7 (default):
# Output: 019c0edc-d74c-7c02-beb9-40fcf2eee5f6
UUID Versions
Generate specific UUID versions:
# UUID v4 (random)
# UUID v7 (timestamp-based, sortable)
# UUID v1 (time-based with node ID)
# UUID v3 (MD5 hash-based)
# UUID v5 (SHA-1 hash-based)
# UUID v6 (sortable time-based)
# UUID v8 (custom)
Version-Specific Options
For v1/v6 (time-based):
--random-node: Use random 6-byte node ID (default)--node-id <HEX>: Specify custom node ID (12 hex characters)
For v3/v5 (hash-based):
--namespace <NS>: Namespace (dns, url, oid, x500, or custom UUID)--name <NAME>: Name to hash (required)
# Output is deterministic: same namespace + name = same UUID
For v8 (custom):
--bytes <HEX>: 32 hex characters (16 bytes)
Output Formats
# Hyphenated (default)
# 019c0edc-d74c-7c02-beb9-40fcf2eee5f6
# Simple (no hyphens)
# 019c0edcd74c7c02beb940fcf2eee5f6
# URN
# urn:uuid:019c0edc-d74c-7c02-beb9-40fcf2eee5f6
# Braced
# {019c0edc-d74c-7c02-beb9-40fcf2eee5f6}
Case Control
# Uppercase
# 019C0EDC-D74C-7C02-BEB9-40FCF2EEE5F6
# Lowercase (default)
# 019c0edc-d74c-7c02-beb9-40fcf2eee5f6
Bulk Generation
# Generate 5 UUIDs
# 019c0edd-19ee-7903-8ec0-cc2098967b15
# 019c0edd-19ee-7903-8ec0-cc324e67abd2
# 019c0edd-19ee-7903-8ec0-cc4871c57653
# 019c0edd-19ee-7903-8ec0-cc552b063bff
# 019c0edd-19ee-7903-8ec0-cc6150da757c
Note: v7 UUIDs are monotonic (sortable by generation time).
Clipboard Integration
# Copy to clipboard
# Copy multiple UUIDs (newline-separated)
Combining Options
# Multiple options at once
# 019C0EDD08B37C42AABE599AEA317DE1
# 019C0EDD08B37C42AABE599D2F5B8A92
# 019C0EDD08B37C42AABE599E5C9A1B23
# (also copied to clipboard)
Why UUID v7?
UUID v7 is the default because it provides:
- Database performance: Time-ordered UUIDs reduce B-tree fragmentation (up to 10x better than v4)
- Sortability: Lexicographic comparison works directly on the UUID bytes
- Modern timestamps: Uses Unix epoch in milliseconds (familiar to developers)
- Monotonicity: Sequential UUIDs are guaranteed to be ordered
- No clock drift issues: Better than v1/v6 for distributed systems
UUID Version Comparison
| Version | Type | Use Case | Deterministic |
|---|---|---|---|
| v1 | Time + Node | Legacy systems | No |
| v3 | MD5 hash | Namespace-based (legacy) | Yes |
| v4 | Random | General purpose | No |
| v5 | SHA-1 hash | Namespace-based | Yes |
| v6 | Sortable time | Database keys (modern) | No |
| v7 | Timestamp | Database keys (recommended) | No |
| v8 | Custom | Special requirements | Depends |
Examples
Generate API keys
Generate sortable database IDs
Generate deterministic UUIDs for testing
Quick clipboard workflow
# Paste anywhere: Cmd+V (macOS) or Ctrl+V (Linux/Windows)
Testing
Run the test suite:
The project includes comprehensive integration tests covering:
- All UUID versions
- Format options
- Deterministic behavior (v3/v5)
- Monotonicity (v7)
- Error handling
- Count functionality
Future Plans
The architecture supports future addition of other ID formats:
- ULID (Universally Unique Lexicographically Sortable Identifier)
- NanoID (URL-friendly unique ID)
- Snowflake (Twitter's distributed ID)
- CUID (Collision-resistant Unique ID)
Example future usage:
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions welcome! Please feel free to submit a Pull Request.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.