Manufacturers (like Samsung, Huawei, or Alcatel) use specific algorithms to link a phone's (International Mobile Equipment Identity) to its NCK. The Calculation:

However, you may have success with:

Several websites host backend scripts that function as an online calculator. These are convenient because you don’t need to download software.

If you are stuck with a locked phone right now, follow this safe workflow:

Entering three or four fake codes generated by a faulty calculator will permanently lock your phone’s unlock counter. After that, even an official code from the carrier will not work. Your only solution becomes a expensive motherboard replacement.