A token is a long random string that proves who you are to a service. It works like a password, except it is made for software rather than people: you paste it into an app or a settings page once, and the service checks it every time that app connects. API keys, password-reset links, webhook secrets and invite links are all tokens. MamaTool's free Token Generator makes one in your browser in seconds. Pick a format, set a length, add a prefix if your service uses one, and copy the result. The token is created on your device and never sent anywhere, so nobody else sees it. Here is how to use the tool, which format to pick, how long a token should be, and the mistakes that get tokens leaked.
How to generate a token, step by step
Open the Token Generator. The format menu is first. Alphanumeric is the default, and it works almost everywhere, so leave it there unless your service asks for something specific. Then set the length with the slider. It runs from 8 to 128 characters, and 32 is the default. For an API key, 32 is a solid starting point. For a secret that will live in production for months, move it up to 64.
Next, add a prefix if your service uses one. Many services start their keys with something like sk- or live_ so the key is easy to recognise in logs and settings pages. Type the prefix into the box and it is added to every token you generate. There is also a checkbox to leave out ambiguous characters — the ones people mix up when reading aloud, like the number 0 and the letter O, or the number 1 and a lowercase L. Turn it on when you might need to read the token over the phone or type it by hand.
Now press Generate. You can make one token at a time, or five or ten at once and pick the one you like best. There is no cost to making ten and using one. Before you copy, look at the strength meter and the entropy figure in bits. Entropy is a measure of how hard the token is to guess. Aim for 128 bits or more for anything that guards real data. A 32-character alphanumeric token comes to about 190 bits, which is far past that line. Copy the token straight into your password manager or your environment file. Do not leave it sitting in a notes app or an open tab.
Which format should you pick?
Each format suits a different job. The four options in the tool cover most of what people need.
| Format | Characters used | Best for |
|---|---|---|
| Alphanumeric | Letters and digits | API keys and most services |
| Hex | Digits 0–9 and letters a–f | Database keys and hash-style values |
| Base64 URL-safe | Letters, digits, dash and underscore | Tokens that travel inside links |
| Numeric | Digits only | Short codes and PINs |
When in doubt, use alphanumeric. It is accepted by nearly every service and packs the most guessing resistance into each character. Hex is the right choice when a service expects a hex string, which is common for database keys and for values that get compared with hashes. Base64 URL-safe is for tokens that appear in a web address, because its characters never need special encoding in a link. Numeric tokens are the weakest per character, so keep them short-lived: a six-digit code that expires in ten minutes is fine, while a numeric token that guards an account for a year is a bad idea.
How long should a token be?
Length is what keeps a token safe. Every extra character multiplies the number of possible tokens, and the entropy figure in bits tells you how far that multiplication has gone. A 32-character hex token carries 128 bits, because each hex character adds 4 bits. A 32-character alphanumeric token carries about 190 bits, because each character adds close to 6 bits. Both clear the 128-bit line the tool recommends for anything that guards real data.
For a throwaway token — a test account, a one-off invite, a demo key — 16 to 32 characters is enough. For a production API key or a webhook secret, use 32 to 64 characters. At 64 characters, an alphanumeric token carries about 380 bits, which is far beyond anything anyone can guess by trying combinations. Copy and paste tokens instead of typing them, or let a password manager fill them in.
Where tokens are used
Tokens show up in more places than most people notice. An API key is a token: it lets your app call a service such as a payment provider or a maps service without a username and password. A password-reset link contains a token, which is why the link works once and then stops working. A webhook secret is a token that lets your server check that an incoming message really came from the service that claims to have sent it. Invite links and share links use tokens too, so that only people with the link can get in. Test and demo accounts often get tokens instead of passwords, because a token can be revoked in one click when the test is over.
Mistakes that leak tokens
Most token leaks are not caused by guessing. They are caused by careless handling. The first mistake is pasting a real token into a chat message, an email or a screenshot. Support threads, group chats and screen recordings are all places tokens end up by accident, and once a token is in a screenshot it stays there. The second mistake is saving a token in a code repository. A key in a public repo can be found and used within minutes.
The third mistake is reusing one token across several services. If one service is breached or one key leaks, every service that shares it is exposed. Give each service its own token, just as you give each account its own password. The fourth mistake is never setting an expiry or rotating a key. A token that has sat unchanged for two years is a token nobody remembers, and nobody will notice when it leaks. Set a reminder to replace long-lived keys every few months. The fifth mistake is making a token by hand. A word from a dictionary, a date, or a keyboard pattern is guessable in a way a random string never is. Let the generator do it.
Generate your first token now
Open the Token Generator and make a token for the next service you need to connect. Use the alphanumeric format at 32 characters, add a prefix if the service uses one, and check that the entropy reads 128 bits or more. Copy it straight into your password manager and give it a clear name, such as the service and the date you made it. If you already have an old API key sitting in a file or an email, replace it with a fresh token today and revoke the old one in the service's settings. For the passwords that protect your own accounts, use our Password Generator, and for short one-time codes, try the OTP Generator. For more practical guides like this one, browse the rest of our articles.