Skip to content
CertoflowCertoflow
Developer Tools

API Key Generator — Random Hex Keys

Random hex API keys.

Last updated: August 2026

Quick reference

What this calculator does
Generate cryptographically random API keys as hexadecimal strings — configurable byte length from 16 to 64, browser-only.
How it works
Set byte length, click Generate API key, and receive a hex-encoded random string from crypto.getRandomValues().
Example
32 bytes produces a 64-character hex key like a4f2c8... suitable for dev API tokens.
When to use it
Creating test API keys, webhook secrets, and development credentials before migrating to a secrets manager.

Guide

Introduction

Every new microservice tutorial ends with "generate a secure API key" — and then shows openssl rand -hex 32 without explaining what happens when your CI runner lacks OpenSSL or your Windows laptop uses a different path. API keys are not passwords users memorize; they are opaque high-entropy byte strings, usually hex- or base64-encoded, that authenticate machine-to-machine calls. Leaking one in a Git commit triggers rotation drills; generating a weak one invites brute-force guessing on poorly rate-limited endpoints.

Certoflow's API Key Generator produces random keys as lowercase hexadecimal using crypto.getRandomValues(). Configure byte length from sixteen to sixty-four (output length is twice the byte count in hex characters). Keys never leave your browser — ideal for local development, integration tests, and prototyping before Vault or AWS Secrets Manager owns production rotation. Combine with Random Bytes Generator when you need the same entropy with explicit "bytes" semantics, or HMAC SHA256 Generator when signing requests with a shared secret.

What this tool does

SettingBehavior
Byte length16–64 bytes (default 32)
Output formatLowercase hexadecimal (two chars per byte)
GenerateNew key on each click
CopyStandard Certoflow copy action

A 32-byte key yields a 64-character hex string — 256 bits of entropy, a common choice for webhook signing secrets and internal service tokens. Sixteen bytes (128 bits) suits lower-risk dev environments; sixty-four bytes maximizes the tool's range for paranoid test fixtures.

The generator outputs hex only. It does not prefix sk_live_, add checksums, or format as JWTs. Apply your application's encoding conventions after generation.

How it works

Generation allocates a Uint8Array of the requested length and fills it with CSPRNG bytes:

const bytes = new Uint8Array(byteLength);
crypto.getRandomValues(bytes);
return Array.from(bytes)
  .map((b) => b.toString(16).padStart(2, "0"))
  .join("");

Each byte maps to two hex digits with leading zero padding (0f, not f). Byte length clamps to the UI range; the underlying function accepts the configured value from the form. No server round-trip occurs.

Hex encoding doubles visible length versus raw bytes but avoids URL-unsafe characters — unlike base64, hex needs no escaping in JSON strings. For URL-safe encoding of arbitrary text, see Base64URL Encoder.

Real-world examples

Local Express API middleware

Bootstrapping an Express app with API-key middleware requires a secret in .env. Generate 32 bytes, paste into API_KEY=..., verify parsing with ENV File Parser, and test signed requests using HMAC SHA256 Generator to match server validation logic.

Webhook endpoint development

Stripe-style webhooks expect a signing secret. Generate 32 bytes locally, configure your test receiver, and compute expected signatures without committing secrets — add .env to Gitignore Generator templates before first push.

Load test fixture rotation

Performance tests need thousands of unique keys. Generate sequentially, paste into CSV, convert with JSON to CSV if your harness expects structured input. Never reuse production keys in load scripts.

Pairing with UUID for compound identifiers

Some systems use keyId:secret pairs. Generate the secret here and a public identifier with UUID Generator or Nano ID Generator for URL-safe IDs.

Teaching entropy in security workshops

Show students a 16-byte versus 32-byte key side by side. Discuss why doubling bytes doubles hex length and bits of entropy. Fingerprint sample keys with SHA-256 Generator only for demonstrations — hashing is not storage.

Common mistakes

Committing generated keys to Git. Even dev keys become attack surface when repos go public. Use environment variables and .gitignore patterns from Gitignore Generator.

Using 16-byte keys in production. Acceptable for ephemeral dev tokens; production webhook secrets typically warrant 32+ bytes. Match your threat model.

Confusing hex length with byte length. A 64-character hex string represents 32 bytes, not 64 bytes. Misreading causes undersized secrets.

Reusing one generated key across services. Each integration deserves a unique secret so one leak does not compromise all vendors.

Storing keys in plaintext databases without hashing. API keys are often verified by constant-time comparison of the full secret, unlike passwords that should be bcrypt-hashed. Still restrict database access and audit logs.

Expecting base64 output. This tool emits hex. Encode differently if your API spec demands base64 — use Base64 Encode on binary interpretation or Random Bytes Generator for the same hex pipeline.

Pasting production keys into any online tool. Certoflow processes locally, but habitually pasting live secrets into browsers trains unsafe behavior. Use synthetic keys for demos.

Use cases

Backend developers seeding .env files during project bootstrap.

QA engineers creating unique credentials per test run.

DevOps practitioners prototyping secret rotation scripts before Vault integration.

Students learning the relationship between bytes, bits, and hex representation.

Integration specialists configuring sandbox API credentials for third-party webhooks.

Security reviewers generating benign sample secrets for documentation screenshots.

FAQ

Are keys stored by Certoflow?

No. Keys exist only in browser memory until you copy or clear them.

What is the default byte length?

32 bytes (64 hex characters).

Is output uppercase or lowercase?

Lowercase hexadecimal (af).

How random are the keys?

crypto.getRandomValues() supplies operating-system CSPRNG bytes — suitable for development and test secrets when combined with proper storage practices.

Can I generate keys offline?

Yes, after the page loads.

How does this differ from Random Bytes Generator?

Both produce hex from random bytes. API Key Generator defaults to 32 bytes with a 16–64 range tuned for API secrets; Random Bytes Generator supports 1–256 bytes for salts and IVs.

Should I use this for production master keys?

Generate here for prototyping, then migrate to a managed secrets store with rotation policies for production.

Can I validate key strength?

Hex keys are evaluated poorly by Password Strength Checker — judge by byte length and storage hygiene instead.

Does the tool add prefixes like sk_?

No. Append application-specific prefixes manually after generation.

What related tools help with signed APIs?

HMAC SHA256 Generator for signature computation and JWT Decoder when tokens embed signed claims.

Frequently Asked Questions

Is data uploaded?
No. All processing runs locally in your browser.
Does this work offline?
Yes, after the page loads.

Related tools that complement this workflow.