NPN and PNP logic gates


This material complements section 2 – combinatorial logic design. I could not find any website with information about logic gates with PNP transistors; for our purposes, the following circuits work fine. As a general note, using a voltage of around 5.5-5v, the resistance at the base of the transistor should be about 10kΩ, while the resistance of the emitter or collector should be about 1-5kΩ. We’ll go over circuits that produce all the possible outputs for one and two inputs.


A buffer strengthens a signal without changing its logic value, i.e., if it receives a logic 1, it outputs a logic 1, and if receives a logic 0, it outputs a logic 0:

NPN and PNP buffers

Not gates

A Nor gate is also called a negator, because it ‘negates’ (or toggles) the input, i.e., if it receives a logic 1, it outputs a logic 0, and if it receives a logic 0, it outputs a logic 1.

NPN and PNP Not gates

We can see that the NPN-based buffer circuit is identical to the PNP-based negator; the only thing we changed was the transistor. The same goes for the circuits of the PNP-based buffer and the NPN-based negator. The reason we can change the circuits without changing the resistors is because the transistors are complementary, e.g., they use about the same power, they specs such that the circuit that places one of the transistors in saturation places the other one in the cut-off region, and we can trigger them with the same base currents.

De Morgan’s laws

The De Morgan’s laws are two transformations of boolean expressions, that allow us to express Or operations as And operations, and vice-versa. They are:

A+B = \overline{\overline{A}\,\overline{B}}\\
AB = \overline{\overline{A}+\overline{B}}

In the rest of this page we will find two-transistor circuits for many 2-input logic functions; these expressions are equal to their De Morgan-transformed expressions.

Series configurations

We connect transistors in series when we stack them one on top of the other, like battery cells in a flashlight.

NPN And gate

We can get an And gate using two NPN transistors connected in series in a common collector configuration:

NPN And gate

PNP Nor gate

When we replace the NPN transistors of the And gate with PNP transistors, we get a Nor gate:

PNP Nor gate

0010 and 0100 series gates

A pair of NPN transistors in series gives us an And gate; a pair of PNP transistors in series gives us a Nor gate; so our next question would be… what if we use one of each? Well… let’s see.

Normally we synthesize logic functions using a combination of standard gates; integrated circuits (IC) chips like those of the 74xx series pack a set of buffers, Not’s, And’s, Or’s, Nand’s and Nor’s. We can any output combining these standard gates. For example, suppose that we want the output to be 0010, i.e., we want the output to be a logic 1 only when the first input is 1 and the second is 0; we can achieve this output combining a Not and an And gate. We could use a Not gate from a 7404 chip and an And gate from a 7408 to get the desired result:

0010 integrated circuit

The 0001 output comes from a standard gate, i.e., the And function; the 0111 output also comes from a standard gate, i.e., the Or function. Both of them have electronic symbols too. However, the 0010 output is does not come from a standard gate, and thus it does not have a name nor an electronic symbol.

The circuits that implement gates in ICs are more complex than the simple gates that we are using in this page. These circuits address aspects like speed or fan-in. Still, suppose that we were to build the 0010 circuit that we built using ICs using our gates instead. If we were to use only NPN transistors, we would get something like this:

0010 standard gates

A straight mapping of the IC circuit to discrete gates requires three transistors: one for the not gate and two for the And gate. The number of transistors in a circuit is proportional to the area that it occupies, the power that it consumes, and the heat that it produces, so in general, circuits with less transistors will take less space, consume less power, and produce less heat, all of which are desirable features.

Interestingly, though, since we are working with discrete transistors, we can build our 0010 function with only two transistors; here is where the combination of NPN and PNP transistors comes into play:

Changing the order of the stacking of the transistors of the 0010 circuit leads to the 0100, i.e., the circuits that produce 0010 and 0100 are electrically equivalent. However, being able to swap the order of the transistors gives us flexibility if we prefer one configuration over the other for wiring purposes.

All the series circuits above have in common that the output has exactly one logic 1 and three logic 0s; we decide which input combination will output the logic 1 changing the transistor type and their stacking order. We can put the circuit ‘upside-down’ and get circuits that produce, not a single logic 1 for a given input, but a single logic 0 for a given input. This is what we’ll work on next.

NPN Nand gate

We can get a Nand gate using two NPN transistors connected in series in a common emitter configuration:

NPN Nand gate

PNP Or gate

When we replace the NPN transistors of the Nand gate with PNP transistors, we get an Or gate:

PNP Or gate

1101 and 1011 series gates

Replacing one of the NPN transistors of the Nand gate with a PNP transistor moves the output 0 to a different combination of inputs as follows:

1101 and 1011 NPN and PNP circuits

Like the 0010 and 0100 circuits, the 1101 and 1011 are not standard and thus, they have no name or electronic symbols.

This concludes all the series configurations for two transistors. Pretty cool, right? We found two-transistor circuits that generate the outputs 0001, 0010, 0100, 1000, 1110, 1101, 1011, and 0111. Now let’s find out what parallel configurations can do for us.

Parellel configurations

We connect transistors in parallel when we place them next to each other, like when we jump-start a car battery with another one.

We might be disappointed to learn that parallel configurations do not gives us any new outputs. Instead, we obtain the same output that we obtained with the series configurations. However, they will become useful at the time when we need to combine series and parallel configurations, so let’s get to it.

NPN Or gate

Since we already described the gates, we will simply reiterate the De Morgan equivalences, the truth tables and point out the circuit:

NPN Or gate

PNP Nand gate

PNP Nand gate

1011 and 1101 parallel gates

1011 parallel gate


1101 parallel gate

NPN Nor gate

NPN Nor gate

PNP And gate

PNP And gate

0010 and 0100 parallel gates

0010 parallel gate


0100 parallel gate

Series and parallel configurations

So far we have seen all the 2-input circuits for which the output has only one logic 1 or one logic 0, with either series or parallel configurations. To put together more complex circuits, we combine the series and parallel ones. For example, we saw that with NPN transistors, we create and And gate stacking them in series, and an Or gate placing them side-by-side, in parallel. Thus, if we need a function that has 1’s in two different places, we can create each one using an NPN And gate, and then combine the two with an NPN Or gate. Of course, we can do the same thing with PNP transistors, or with a combination of NPN and PNP transistors. So let’s finish this page with the circuits that have two logic ones at their output.


The name ‘Xor’ comes from ‘Exclusive-Or’. Both the 2-input Or and the Xor functions output a logic 1 if either of their inputs is a logic 1, but Xor requires that only one of the inputs can be a 1, thus ‘excluding’ the (1,1) input from yielding a 1. The Xor function is important enough that it not only gets its own name, but also gets its own operator symbol ⨁. Hence,

A\oplus B & = \overline{A}B+A\overline{B}\\
&= \overline{(A+\overline{B})(\overline{A}+B)}

The Xor truth table, electronic symbols, and IC are:

Xor truth table, electronic symbol and IC chip

To come up with the Xor circuit we need to take a look at its truth table. We already know circuits that output a single 1. Since the Xor outputs two ones – one for the (0,1) input and another for the (1,0) input, what we could do is to take the 0100 circuit, which outputs a one for (0,1), take the 0010 circuit, which outputs a one for (1,0), and add them up to obtain a circuits that outputs a one for both (0,1) and (1,0), namely Xor. This leads to the most common Xor circuit:

Xor = OR(0010, 0100)

That was easy! Now we have options of how to build this circuit using combinations of NPN and PNP transistors. We can build it exactly how the circuit is drawn, with 2 negators, 2 And circuits, and 1 Or circuit. This amounts to 8 transistors: 1 transistor per negator and 2 transistors for each And and Or gate. For example, the following is such circuit built with only NPN transistors:


Of course, we can build the Xor using only PNP transistors instead of NPN ones or, if we have the flexibility of using both NPN and PNP transistors, we can use our 0010 and 0100 circuits and build the Xor with only four transistors:

Xor – 4 transistors – OR(0010, 0100)

If we look again at the truth table and we focus on the zeros instead of the ones, we obtain a different circuit. In this case, we want a circuit that produces a 0 only when both inputs are zero, i.e., an Or gate, and another circuit that produces a 0 only when both inputs are one, i.e., a Nand gate. To obtain the Xor we And the outputs of the Or and Nand gates:

Xor : And (Or, Nand)

Again, we could implement this circuit directly, using 6 transistors (2 for each gate), but if we have the flexibility of using both NPN and PNP transistors also can build it with four transistors:

Xor – 4 transistors – AND(Nand, Or)


The 2-input Xnor gate is the complement of the 2-input Xor, so it toggles the output of the Xor, so it outputs a logic 1 when both inputs are 0 or 1. The Xnor operator symbols is ⨀.

0101 and 1010

Final comments

Usually there are many ways to solve a problem. Even with something as simple as finding a circuit that implements the 2-input-1-output logic functions described above, we have found solutions that use standard gates, series configurations, and parallel configurations. Most problems in life are the same: there are multiple solutions to any problem, and if we look carefully, we’ll find that some are better than others depending on the resources that we have at hand.

NPN and PNP transistors are two sides of the same coin. Whatever we can do with an NPN transistor, we can do with a PNP transistor. There are certain tradeoffs that have made NPN transistors a better choice for integrated circuit design. However, these tradeoffs have little to do with discrete element design. What we do not want is to ignore to possible solutions to a problem because we might have been blindsided to only a set of solutions that comes from the popularity of NPN designs and the standardization of gates in chips.