Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Open drain vs push-pull: two ways to drive an output pin

A push-pull output has two transistors: one that connects the pin to the supply to drive it HIGH and one that connects it to ground to drive it LOW, and exactly one of them is on at a time. In CMOS that pair is a PMOS above an NMOS, the same pair that makes an inverter. An open-drain output keeps only the lower transistor, an NMOS whose drain is the pin: it can pull the pin LOW, but when it turns off the pin is simply left floating, so an external pull-up resistor (or current source) is needed to bring it HIGH. Open collector is the same idea with a bipolar transistor. In short: push-pull drives both levels hard and fast but must have the line to itself; open drain only pulls LOW, which lets many outputs share one line.

What each one is good at

Push-pull is the default for ordinary logic outputs: it drives the line actively in both directions, so rising and falling edges are both fast, it draws no current through a resistor while idle, and it needs no extra parts. Its limit is sharing: if two push-pull outputs on one line disagree, one drives HIGH while the other drives LOW, a short from supply to ground. Open drain is good exactly there. Several outputs can share one line, and the line is LOW if any of them pulls it LOW and HIGH only when all of them let go, a wired-AND. That is how shared interrupt and reset lines work, and the I2C bus requires it: its specification says SDA and SCL are connected to the positive supply through a pull-up, and every device output stage must be open-drain or open-collector to perform the wired-AND function. Because the pull-up sets the HIGH level, open drain can also shift levels, for example a 3.3 V chip pulling a 5 V line LOW. The costs are a slower rising edge, set by the resistor and the line capacitance, and current through the resistor whenever the line is held LOW.

See both output stages in digiwleea

digiwleea simulates transistors as switches, so you can see both output stages directly. The live CMOS inverter is a push-pull stage: a PMOS pulls the output HIGH and an NMOS pulls it LOW, never both at once. Take the PMOS away and you have an open-drain output: as the NMOS switch lesson shows, a lone NMOS drives a solid 0 when it is on and leaves the wire floating, shown as Z, when it is off. digiwleea has no resistors, so it cannot simulate the pull-up itself; the floating Z is exactly the state the pull-up exists to fix. For another way to share a line, compare the tri-state buffer, which drives both levels but can disconnect, and the tri-state lesson.

Open drain and push-pull side by side

Push-pullOpen drain
TransistorsTwo: to the supply and to groundOne: to ground
Drives HIGHYes, activelyNo, a pull-up resistor does
Drives LOWYesYes
Several outputs on one lineNo, they would shortYes, a wired-AND
Rising edgeFastSlower, set by the pull-up
Typical useOrdinary logic outputs, SPI, UARTI2C, shared interrupts and resets, level shifting

No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.

More comparisons: Digital logic concepts compared

See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.

Open the digiwleea lab →

Frequently asked

What is the difference between open drain and push-pull?

A push-pull output actively drives both HIGH and LOW with two transistors. An open-drain output has only the transistor to ground, so it can drive LOW or let go, and a pull-up resistor makes the line HIGH when it lets go.

Why does an open-drain output need a pull-up resistor?

Because when its transistor is off nothing connects the pin to anything, so the line floats at an undefined level. The pull-up resistor holds the line HIGH unless some output pulls it LOW.

Why does I2C use open drain?

Because many devices share the SDA and SCL lines. With open-drain outputs and pull-ups, any device can pull a line LOW without fighting the others, which gives the wired-AND behaviour I2C relies on for clock stretching and arbitration.

What is the difference between open drain and open collector?

Only the transistor type: open drain uses a MOSFET, whose drain is the output pin, and open collector uses a bipolar transistor, whose collector is the output pin. Both can only pull LOW and need a pull-up.

Can two push-pull outputs be connected together?

Not safely when they can disagree: one would drive the line HIGH while the other drives it LOW, shorting the supply to ground through both. Shared lines use open-drain outputs or tri-state outputs that only one device enables at a time.

Is open drain slower than push-pull?

On the rising edge, usually yes. The line is pulled HIGH only by the resistor charging the line capacitance, while a push-pull output drives it HIGH with a transistor. A smaller resistor speeds it up but wastes more current when the line is LOW.