Blog / Build with AI /

Licence keys explained for small software

You’ve built something people might pay for. A small app, a plugin, a script. Now a practical question appears, usually at 11pm: how do I make sure only people who paid can use it?

The answer is a licence key. The honest follow-up is that licence keys are less powerful than they look. Understanding what they can and can’t do will save you a lot of effort and a lot of grief.

What a licence key is

A licence key is a string, something like ABCD-1234-EFGH-5678, that you give a customer when they buy. Your software asks for it and checks it. If it passes, features unlock. If not, they don’t.

Think of it as a ticket to a concert. The ticket proves someone paid. The hard part is the doorman: who checks it, how carefully, and what happens when someone copies the ticket.

The three common designs

1. Offline signed keys

The key is generated using a secret on your side, and contains (or is paired with) a digital signature. Your software holds a matching public piece that can verify the signature without contacting your server.

  • Good: works without internet, no server to run, no downtime.
  • Bad: you can’t switch off a key once issued, and the same key can be shared. Anyone who reverse-engineers the check can bypass it.

2. Online activation

The software sends the key to your server. The server checks it against a database and replies “valid” (and maybe “this is activation 2 of 3 allowed”). Many commercial plugins and apps work like this.

  • Good: you can revoke keys, limit the number of devices, and see how many are in use.
  • Bad: you need a server that stays up, and customers with no connection can’t activate. Users also dislike being locked out because your server had a bad day.

3. Account-based licensing

There’s no key to type. The user signs in, and the account holds the subscription or licence. Common with web apps.

  • Good: simple for the user, easy to manage on your side.
  • Bad: requires accounts, password resets and ongoing hosting.

Many products mix these: an online check on first use, then a stored token that works offline for a while.

What a licence key can’t do

Be clear-eyed about this before you spend weeks on it.

  • It can’t stop determined piracy. Anything that runs on someone’s machine can be modified by someone clever enough. Software that checks a key locally can have that check removed.
  • It can’t fix a product nobody wants. The effort of protecting your tool is wasted if the market isn’t there yet.
  • It doesn’t replace good terms. A short licence agreement says what customers may and may not do.

What it can do is keep honest people honest. Most customers aren’t pirates. They want a simple way to pay, activate and get on with their work. The point of a licence key is to make the honest path easy, and casual sharing slightly harder.

Choosing for a small product

Questions to answer first:

  1. Is it a web app, a desktop app, a plugin or a script? Web apps usually don’t need a key at all; accounts are the licence. Plugins and downloadable tools do.
  2. How much is one copy worth? For a low-priced tool, the cost of heavy protection can exceed the lost sales.
  3. Do customers work offline? If yes, lean toward offline-verifiable keys.
  4. Do you want updates only for subscribers? Then the key should control access to updates, not to the software working at all. Many plugin sellers do this: the plugin keeps working, but updates and support require a valid key.
  5. Can you run a server reliably? If not, avoid designs that need one.

For a first product, a sensible shape is: online check for updates, grace period if the check fails, and the product never breaks just because your server was down for an hour.

Doing it yourself vs using a service

Writing your own licence server is a good learning project and a bad business decision. You’ll end up handling payment webhooks, key generation, expiry, activation limits, support emails and abuse. Hosted licensing services and payment platforms that include licence keys handle that. Look at what your payment provider offers before you build anything.

If you do build a small one, keep the pieces separate:

  • A table of keys with an owner, a status and an expiry.
  • An endpoint that validates a key and records the site or device.
  • A way to revoke a key.
  • Rate limiting, so nobody can brute-force valid keys.

Generate keys from a proper random source, not a pattern. Sequential or guessable keys can be found by trial.

Design the experience, not only the lock

The best licensing is barely noticed.

  • Show a clear message when a key is invalid, and say why (expired, too many devices, mistyped).
  • Allow customers to move a licence to a new computer without writing to you.
  • Don’t delete user data when a licence expires.
  • Offer a trial that works properly, so people can judge it.
  • Keep the key in the customer’s account or receipt email, so they can find it again.

A product that frustrates paying customers loses more than it gains from stopping thieves.

If you build it with AI help

AI assistants will gladly write a licence check for you, and it’ll look convincing. Be careful:

  • Never put a signing secret or private key in the code you ship. That’s the same trap as putting API keys in front-end code.
  • Validate on the server, not only in the browser or app.
  • Test the failure cases: wrong key, expired key, no internet, server error.
  • Don’t write your own cryptography. Use well-known libraries and standard signature methods.

And check what you’re shipped, as I describe in AI-written code: five mistakes to check before you trust it.

Why a web admin should care

If you run client sites, you already depend on licence keys: premium themes, plugins, SEO tools. A licence that expires can silently stop updates, and an out-of-date plugin is a security issue. Keep a list of which plugins on which sites need a licence, who holds the account and when it renews. It belongs in the same register as domains and hosting.

Key takeaways

  • A licence key is a ticket; the hard part is who checks it and how.
  • Three common designs: offline signed, online activation, account-based.
  • Keys keep honest people honest; they don’t stop determined piracy.
  • Make the product keep working if your server is down, and don’t build a licence server if a service can do it.

If you were selling a tiny tool next month, which design would you choose, and why?