All Tools View Categories About Contact Privacy

Random Secret / API Key Generator

Generate cryptographically-random placeholders: prefixed API keys, hex, or custom-alphabet values.

Runs entirely in your browser — nothing is uploaded.

About Random Secret / API Key Generator

A placeholder key in a .env file should look like the real thing but must never be guessed to be real. The Random Secret / API Key Generator produces cryptographically-random values for exactly that job: prefixed API keys, hex digests, URL-safe tokens, or values from a custom alphabet.

Every value uses crypto.getRandomValues, the browser's secure entropy source. You control prefix, length, alphabet and batch count, so a whole set of .env.example placeholders can be generated in one shot.

Generation never leaves the page — no uploads, no history, no logging.

Features

  • Prefix support: sk_, pk_, test_, custom.
  • Two alphabets: hex and URL-safe base64.
  • Custom alphabet: exact character set.
  • Length control: from 8 to 256 chars.
  • Batch mode: generate 1-50 at once.
  • KEY= line format: ready to paste into .env.
  • Copy or download: export the set.
  • Secure source: crypto.getRandomValues.

How to Use

  1. Pick the format (API key, hex, or custom alphabet).
  2. Set prefix, length, and count to taste.
  3. Click Generate. Fresh values appear instantly.
  4. Copy or download them as KEY= lines for your .env.

Examples

Example 1 — .env.example placeholders. A team generates sk_test_-prefixed keys so the committed example never contains a real value but still looks right.

Example 2 — Local dev rotation. A developer regenerates SESSION_SECRET locally before each pre-release run.

Example 3 — Demo credentials. A demo bundle gets throwaway keys that are obviously fake yet syntactically correct.

Example 4 — Audit-friendly tokens. Ops generates URL-safe tokens for webhook validation without plus-slash characters.

Example 5 — Batch onboarding. Someone spins up five service keys for a new environment in one click.

Benefits

  • Secure source: real entropy, not Math.random.
  • Env-ready: outputs valid KEY= lines.
  • Flexible: prefix, length, alphabet, count.
  • Instant batch: many values at once.
  • Private: never leaves the browser.
  • Free: endless fresh keys.

Frequently Asked Questions

What can this generate?
Cryptographically-random values suitable for env placeholders: API keys with an optional prefix (sk_, pk_, test_), plain hex digests, URL-safe base64 tokens, and values from a custom alphabet.
Is it really random?
All randomness comes from crypto.getRandomValues, the browser's secure random source — not Math.random. Fine for generating placeholder secrets and local dev keys.
What length should I use?
A good default is 32-64 characters. Longer is not always better; a 128-bit random value (about 22 base64url chars) is already strong. The tool defaults to 48.
Is it a secrets manager?
No. It is for generating placeholder values to put into .env files. Real production secrets should still live in a proper secrets manager.
Are keys stored or uploaded?
No. Generation is in your browser; nothing is uploaded, stored, or logged.