The term PIN is commonly used when only a numberpad is available for the user (SIM card, credit card, ...).
Today the term seems to be extended to every kind of password of digits only.
PIN can be considered as secure when the following conditions are enforced:
- the authentication is blocked after 3 failed attempts
- all PINs are equally likely
- the PIN is used on a physical device
In this scheme, even with only 4 numbers, the attacker needs to obtain physical access before any attack attempt (not trivial).
There is a 3/10000 odds of success.
The combination of these two efforts is very high to overcome.
Depending on whether or not the user chooses the PIN, it could be necessary to forbid some values like (0000, 1234, birthdate, ...).
If the authentication does not occur on a physical device (like a bank login interface), an attacker with a sufficient amount of valid usernames (which are not considered as a secret in the Kerckhoffs's principle), let's say 333 valid accounts for a 4 digit PIN, can probably overtake an account.
But this case doesn't let the attacker select a victim. He knows that he will find one, but he cannot choose which one.
Despite the fact that the username is not supposed to be a secret, companies who use PIN online commonly make it difficult to guess (e.g bank login are often a digit suite instead of the name of the client).
For online authentication, the best practice remains to use passwords not limited in length and charsets.
Furthermore, PIN are more difficult to remember than words and not more difficult to hack. So avoid it when you can.
PIN should be reserved for the use case when only a numberpad is available.