Home › Developer Tools › API Key Generator

API Key Generator

Generate API keys and secrets the way modern platforms do: a readable prefix, a crypto-random body with a chosen number of bits and an optional checksum, plus the SHA-256 hash you should store instead of the key.

Last updated:

Entropy per key–
Key length–

Export

Generated keys

    Check a key

    Advertisement
    Advertisement

    How to use the API Key Generator

    1. Choose a format: Base62 is compact and copy-friendly, hex is universal, Base64url packs the most bits per character.
    2. Pick the strength in bits (256 is a good default) or type an exact length.
    3. Add a prefix such as sk_live_ and decide on a checksum or grouping.
    4. Press Generate Keys, then copy single keys or export them all as .txt, .env, JSON or CSV.
    5. Store only the SHA-256 hash on your server and show the key to the user once. Use the checker to validate keys later.

    Anatomy of a modern API key

    Many platforms now use keys made of three parts, for example sk_live_edblw91dbgYb3B9AsPvJSkkfSQR8CtkWCnyLQBkqewL0oZJzF:

    PartExamplePurpose
    Prefixsk_live_Says what the key is (secret / publishable) and where it works (live / test). Makes leaked keys easy to spot and scan for.
    Random body43 Base62 charactersThe secret part: 43 × log2(62) = 256.0 bits of entropy from a cryptographic random generator.
    Checksum6 Base62 charactersCRC32 of everything before it, written in Base62. Detects typos and lets scanners ignore random look-alikes. Not secret.

    To validate the checksum in your own code: take the key without its last 6 characters (and a trailing - if you used grouping), compute the standard CRC-32 (IEEE, the same as zlib's crc32), convert the number to Base62 with the alphabet 0-9A-Za-z and left-pad it with 0 to 6 characters.

    Key length for each format

    FormatBits per character128 bits256 bits512 bits
    Hex4.00032 chars64 chars128 chars
    Base325.00026 chars52 chars103 chars
    Base625.95422 chars43 chars86 chars
    Base64url6.00022 chars43 chars86 chars
    UUID v4–always 36 chars with 122 random bits

    Length = ⌈bits ÷ log2(alphabet size)⌉. The tool rounds up, so the entropy shown can be a little above the target (for example 22 Base62 characters give 131.0 bits).

    Storing and checking keys safely

    1. Generate the key, show it to the user once and never log it.
    2. Store SHA-256(key) together with the prefix and the last 4 characters for display (for example sk_live_…ZJzF).
    3. On each request, verify the checksum first (cheap rejection of garbage), then hash the presented key and look the hash up with a constant-time comparison.
    4. Support several active keys per account so keys can be rotated without downtime, and let users revoke them.

    A fast hash is fine for API keys because they carry 128+ bits of randomness, which cannot be brute-forced. Human-chosen passwords are different and need a slow hash such as bcrypt or Argon2.

    Frequently asked questions

    How many bits should an API key have?

    At least 128 bits of entropy, which makes guessing impossible in practice. 256 bits is a common choice and matches the key size of HMAC-SHA256 and AES-256. The entropy card shows the exact figure for your settings; the prefix and checksum do not add any.

    Why add a prefix to an API key?

    A prefix such as sk_live_ tells people and tools what the key is for and which environment it belongs to. It makes leaked keys easy to recognise in logs and lets secret-scanning tools find them in code repositories.

    What is the checksum for?

    The last 6 characters can be a CRC32 checksum of the rest of the key, encoded in Base62. Your API can reject mistyped or truncated keys without a database lookup, and scanners can tell real keys from random look-alikes. The checksum is not secret and adds no security.

    Should I store API keys in my database?

    Store a hash instead. Because API keys are long and random, a fast hash like SHA-256 is enough (unlike passwords, which need bcrypt or Argon2). When a request arrives, hash the presented key and look the hash up. The tool shows the SHA-256 hash of each key for this purpose.

    Which format should I choose?

    Base62 (0–9, A–Z, a–z) is compact and selects with a double-click. Hex is accepted everywhere but longer. Base64url is the shortest but includes - and _. Base32 is case-insensitive, which helps when keys are read aloud. UUID v4 has a fixed 122 bits.

    Are the keys generated securely and privately?

    Yes. Keys come from crypto.getRandomValues with rejection sampling, so every character is equally likely. Everything runs in your browser and no key is sent or stored anywhere.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Password GeneratorCreate strong passwords and passphrases.SHA-256 Hash GeneratorSHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.Extended Euclidean Algorithm CalculatorFind gcd(a, b) and Bézout coefficients x, y with the full step-by-step division table.Nano ID GeneratorGenerate secure Nano IDs with custom alphabet, length and count, plus a collision calculator.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.WordPress Salt GeneratorGenerate fresh WordPress security keys and salts for wp-config.php, .env or Docker in one click.QR Code GeneratorMake QR codes for links, Wi-Fi, email and more.Barcode GeneratorCreate Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG.Schema Markup Generator (JSON-LD)Create JSON-LD structured data for FAQ, Product, Article and more.Htaccess & Nginx Redirect GeneratorBuild 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects.Fake Data GeneratorGenerate mock data as JSON, CSV or SQL.Random String GeneratorGenerate secure random strings and tokens in bulk with any length and character set.MIME Type LookupFind the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries.Cron Expression GeneratorBuild crontab schedules visually, read them in plain English and see the next run times.URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines.JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.Gitignore GeneratorBuild a .gitignore from 50+ templates for languages, frameworks, IDEs and OS, merged and deduped.License GeneratorCreate a LICENSE file for MIT, Apache, GPL, BSD, ISC, MPL or Unlicense with your name and year.ULID GeneratorGenerate sortable ULIDs and UUID v7 in bulk, monotonic option, and decode their timestamps.Htpasswd GeneratorCreate .htpasswd entries with bcrypt, APR1-MD5 or SHA-1 for Apache and Nginx basic auth.Placeholder Image GeneratorCreate placeholder images in any size, color and text as PNG, JPG, WebP, SVG or data URI.Ads.txt GeneratorCreate or validate ads.txt and app-ads.txt files: seller lines, cert IDs and variables.Docker Run to Compose ConverterConvert docker run commands to docker-compose.yml, or a compose file back to docker run.Dockerfile GeneratorGenerate a production Dockerfile and .dockerignore for Node, Python, Go or a static nginx site.HTML Boilerplate GeneratorTick the options you need and get a clean HTML5 starter template with meta, OG tags and CSS reset.JSON to Zod SchemaInfer a Zod (or Yup) schema from sample JSON with optional, nullable and z.infer types.Linux Commands Cheat SheetSearchable Linux and bash command reference with flags explained, examples and copy buttons.LLMs.txt GeneratorBuild an llms.txt file for AI crawlers: summary and link sections, import from your sitemap.Nginx Config GeneratorBuild an nginx server block: static site, SPA, reverse proxy or PHP, with SSL, gzip and redirects.OpenAPI / Swagger ViewerView OpenAPI 2/3 JSON or YAML as interactive API docs with validation and an endpoint list.package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.PKCE Code Challenge GeneratorGenerate an OAuth 2.0 PKCE code_verifier and S256 code_challenge, build auth URLs, verify pairs.README GeneratorFill in a form and get a polished README.md with badges, install, usage and license, live preview.Regex GeneratorBuild regular expressions visually from blocks or presets (email, date, phone) and test them live.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Database Schema DesignerDesign tables and relationships visually, then export SQL for MySQL, PostgreSQL or SQLite.HowTo Schema GeneratorCreate HowTo JSON-LD with steps, tools, supplies, total time and cost, then copy it.Htaccess GeneratorBuild an Apache .htaccess file: HTTPS, www, gzip, caching, error pages, IP blocks, hotlinks.HTML Email Template BuilderDrag and drop blocks to build a responsive, table-based HTML email with inline styles.Organization Schema GeneratorCreate Organization JSON-LD with logo, URL, contact points, address and social profiles.PIN GeneratorGenerate random 4, 6 or 8-digit PINs that avoid sequences, repeats, dates and common PINs.Product Schema GeneratorBuild Product JSON-LD with price, availability, brand, GTIN, ratings and reviews.Question Keyword GeneratorFind the questions people ask about a topic, grouped by who, what, why, how, can and more.Recipe Schema GeneratorCreate Recipe JSON-LD with ingredients, steps, prep and cook times, nutrition and ratings.Security Headers GeneratorPick HSTS, CSP, frame, referrer and permissions options and get Apache, Nginx, Netlify or Cloudflare config.SKU GeneratorBuild consistent SKUs from brand, category, size and color, then export every variant as CSV.Typography Scale GeneratorBuild a modular type scale from a base size and ratio, then copy CSS variables or a Tailwind config.ANSI Color Code GeneratorStyle terminal text with 16, 256 or RGB colors and get escape codes for bash, Python, JS and C.Apache Virtual Host GeneratorCreate an Apache VirtualHost config with SSL, redirects, reverse proxy or PHP-FPM in seconds.Bash Prompt GeneratorDrag and drop a custom PS1 prompt for bash or zsh with colors, git branch and a live preview.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.cURL Command BuilderBuild curl commands from a form: method, headers, query, JSON or form body, auth and flags.Docker Compose to KubernetesConvert docker-compose.yml into Kubernetes Deployment, Service, ConfigMap and PVC manifests.Docker Compose ValidatorCheck a docker-compose.yml for YAML errors, schema mistakes, broken references and deprecated keys.Dockerfile LinterLint a Dockerfile for best practices: pinned tags, apt cleanup, non-root USER and layer count.Dockerignore GeneratorBuild a .dockerignore from Node, Python, Go and Java templates, plus your own entries.ESLint Config GeneratorGenerate a flat eslint.config.js for JavaScript, TypeScript, React or Node with rule presets.Git Branch Name GeneratorTurn a ticket ID and title into a clean, valid git branch name like feature/PROJ-12-add-login.GitLab CI Config GeneratorGenerate a .gitlab-ci.yml with stages, jobs, images, cache, artifacts and rules from templates.Jinja2 Template TesterRender Jinja2 templates with YAML or JSON variables using real Jinja2, with clear error lines.JSON Schema Mock Data GeneratorGenerate realistic sample JSON from a JSON Schema: formats, patterns, $ref, seeds and counts.Kubernetes Secret GeneratorCreate Kubernetes Secret YAML from key/value pairs or .env with auto base64, or decode one.Kubernetes YAML ValidatorValidate Kubernetes manifests against the API schema of a chosen version, with error paths.Prettier Config GeneratorToggle Prettier options, preview formatted code live and copy your .prettierrc file.Quartz Cron GeneratorBuild and explain Quartz and Spring cron expressions with seconds, ?, L, W and #, plus next fire times.README Badge GeneratorCreate Shields.io-style README badges for license, version, build and custom labels.
    See all 85 Code Generators & Builders →