A keygen (truncation of "key generator") is a small program that will generate a key or serial/registration number for a piece of software. It is typically used as an adjunct to software piracy.

The advantage of using a keygen (as opposed to just finding a serial on the web) is that the generated key will be unique, (as it is generated on the spot using the same methods as the software vendor) and not traceable or in use by the legitimate owner.

These are usually written by cryptology enthusiasts.