The difference between NPN and PNP transistors is in their internal structure and the direction the electrical current flows. Most of the time, either type of transistor may be used.
NPN and PNP are both bipolar junction transistors, used to amplify currents. NPN stands for Negative-Positive-Negative and PNP stands for Positive-Negative-Positive. Although their function is the same, the distinction between them has to do with how voltage is allocated. This, in turn, causes the electrical current flow to differ. It flows from the collector to the emitter in an NPN transistor, and this direction is reversed in a PNP transistor.
Another distinction between NPN and PNP transistors is how they are powered on. An NPN transistor is turned on when there is enough of an electrical current at its base. By contrast, a PNP transistor will only power on when there is no electrical current present at the base. The base of both types of transistors is located between the collector and the emitter. This phenomenon is known as "sinking" current or "sourcing" current. PNP transistors sink the current, while an NPN transistor sources it.
Both PNP and NPN transistors may also be used as switching devices with DC currents. As with their function in amplifying currents, the only difference is the direction of voltage flow.