API Key Generator
Generate random strings for application secrets or testing, with selectable formats, prefixes, and bulk export.
Updated
What is the API Key Generator?
Generate random strings for use as application secrets or test tokens. This browser-based API Key Generator supports several character formats, optional prefixes, and batch export.
Choose from hex, Base62, Base64URL, alphanumeric, UUID v4, or a custom character set. Set a length from 8 to 256 characters and generate up to 50 values at once. The optional prefixes are plain text labels: they do not create valid credentials for Stripe, GitHub, AWS, or any other service. Use a service's own console to issue its credentials.
The tool estimates randomness from the body length and character set. Treat this as a guide, protect copied secrets, and store them in a secrets manager. Results can be copied or exported as plain text, JSON, or CSV.
How it works
Pick a format
Select hex (lower or upper), Base62, Base64URL, alphanumeric variants, UUID v4 (with or without hyphens), or define your own custom charset. Each format maps to a fixed alphabet used for random selection.Set length and quantity
Choose body length (8–256 characters; fixed for UUIDs) and how many independent keys to produce (1–50). Longer keys and larger alphabets increase entropy.Add optional prefix or suffix
Use a preset or type a custom string. Prefixes are added as literal text and do not make a value valid for the service named by that prefix. They do not add randomness to the key body.Optional hex grouping
For hex formats you can split the body into fixed-size groups separated by a chosen delimiter (e.g.a1b2-c3d4-…) for readability.Generate
Click Generate. The tool draws uniform random values viacrypto.getRandomValues, maps them onto the selected alphabet with rejection sampling (no modulo bias), and assembles each key. Entropy is calculated asbodyLength × log₂(charsetSize).Copy or export
Copy any single key, or export the whole batch as plain text (one key per line), JSON array, or CSV. Download as a file if needed. Regenerate at any time with the same settings for a fresh set of tokens.
Generation runs in your browser. Copy or export only to a secure destination; avoid leaving secrets in downloads, clipboard history, or shared devices.
Examples
Prefixed random value
A random hex body with a literal prefix. This is not a credential issued by Stripe or another provider.
Format: Hex (lowercase), Length: 32, Prefix: sk_live_, Count: 1sk_live_a1b2c3d4e5f6789012345678abcdef01UUID v4 access token
RFC 4122 version-4 UUID for session or resource identifiers.
Format: UUID v4, Prefix: none550e8400-e29b-41d4-a716-446655440000Base64URL JWT-style secret
URL-safe 43-character token suitable for HMAC signing secrets.
Format: Base64URL, Length: 43, Prefix: nonexK9mP2qR7sT4vW8yZ1aB3cD5eF6gH0jL2nM4pQ6rS8tUBulk test values with a prefix
Five random alphanumeric strings with a literal prefix; these are not GitHub credentials.
Format: Alphanumeric, Length: 36, Prefix: ghp_, Count: 5ghp_AbCdEfGhIjKlMnOpQrStUvWxYz012345
ghp_ZyXwVuTsRqPoNmLkJiHgFeDcBa987654
…Frequently asked questions
Are the generated API keys cryptographically secure?
Are the generated API keys cryptographically secure?
The generator uses the browser's Web Crypto API (crypto.getRandomValues) and rejection sampling for the random body. This creates random values locally, but security also depends on how you store, distribute, and use them.
Do the keys leave my browser or get stored?
Do the keys leave my browser or get stored?
Generation runs in your browser. Values you copy or download may remain in the clipboard, browser downloads, or device backups, so protect them accordingly.
How long should an API key be?
How long should an API key be?
The entropy estimate depends on the random body length and alphabet size. For example, 32 uniformly random hex characters provide 128 bits before any prefix. Choose requirements appropriate to your application and store generated secrets securely.
What is the difference between hex, Base62, and Base64URL?
What is the difference between hex, Base62, and Base64URL?
Hex uses only 0-9a-f (or A-F)—maximum compatibility, longer for the same entropy. Base62 (0-9A-Za-z) is compact and URL-safe without special characters. Base64URL (A-Za-z0-9-_) is used by JWTs and other formats, but choosing it alone does not create a valid JWT or service token.
Can I use these keys in production?
Can I use these keys in production?
You can use a generated random value as an application secret if your system accepts that format. This tool cannot issue credentials for a third-party service; obtain those through the provider's official console. Store secrets securely, avoid committing them to source control, and apply appropriate access controls.
Why add a prefix such as sk_live_ or ghp_?
Why add a prefix such as sk_live_ or ghp_?
Prefixes are only labels added to the value. They do not register or authenticate a key with the named provider, and can make the result look like a real credential when it is not. The random body supplies the estimated entropy.
What does the entropy number mean?
What does the entropy number mean?
Entropy (in bits) estimates how hard the key is to guess by brute force. It is calculated as body length × log₂(number of distinct characters in the alphabet). The estimate is based on the configured body alphabet and length, and assumes uniform random selection. It does not account for handling, exposure, or the requirements of a particular service.
Can I generate multiple keys at once?
Can I generate multiple keys at once?
Yes. Set the count from 1 to 50. Each key is generated independently. You can copy them individually or export the whole batch as text, JSON, or CSV.
Is UUID v4 suitable as an API key?
Is UUID v4 suitable as an API key?
UUID v4 provides 122 bits of random entropy and is convenient when you need a standardized 36-character (or 32-character hyphen-free) identifier. For high-security secrets many teams prefer longer custom-format tokens with 256 bits of entropy.
What character sets are supported for custom keys?
What character sets are supported for custom keys?
Any Unicode characters you supply. Duplicates are removed automatically; the alphabet must contain at least two distinct characters. Entropy is computed from the unique character count.
Related tools
More utilities you might find handy.
Bcrypt Format Demo
Inspect bcrypt-like string structure and demonstrate a non-interoperable password-hash format.
CRC32 Generator
Instantly generate CRC32, CRC32C, BZIP2, MPEG-2 and other checksums for text, files, hex or Base64 – 100% client-side.
File Hash Checker
Compute MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of files or text entirely in your browser with no upload.