Data tools

We never see your keysFree, no sign-up

API key generator

A strong random key is ready to copy. Pick the length, the characters and a prefix.

Guide

How to generate an API key

  1. Copy the key that's ready

    A 32-character key appears when the page opens.

  2. Shape it for your app

    Choose the length and characters, and add a prefix like sk_live_.

  3. Store the hash, hand out the key

    Keep the SHA-256 on your server and give the key to the user once.

Know-how

Good to know

Updated

How long should an API key be?

Aim for at least 128 bits of randomness. That's 22 letters-and-numbers characters, 32 hex characters or 22 URL-safe characters; the default 32 letters and numbers gives 190 bits. Longer adds nothing you'd notice except length.

The prefix adds no strength. It tells people and secret scanners what the key is for, which is why services like Stripe and GitHub use them: sk_live_, ghp_.

Storing keys safely

Treat an API key like a password: show it once, then store only a hash of it. When a request comes in, hash the key it sends and compare. A random key this long doesn't need a slow password hash; SHA-256 is enough.

Questions

Not here? Email us.