Logic Gate
A logic gate is an electronic circuit that takes one or more binary inputs, each a high or low voltage standing for 1 or 0, and produces a single binary output determined by a fixed Boolean function of those inputs. The standard set is NOT (inverts its one input), AND (output 1 only if all inputs are 1), OR (output 1 if any input is 1), XOR (output 1 if the inputs differ), and the inverted forms NAND, NOR and XNOR. Gates are the smallest units of digital logic: they are where the abstract algebra of true and false becomes physical hardware, and every adder, multiplexer, register and processor is an arrangement of them.
Gates are built from transistors, and the construction explains why some gates are cheaper than others. In CMOS, the technology behind essentially all modern chips, a NOT gate is two transistors, one pulling the output up to the supply voltage and one pulling it to ground, and a two-input NAND gate takes four: two in series on the pull-down side and two in parallel on the pull-up side. AND and OR are not primitive; they are a NAND or NOR followed by an inverter, so they cost more transistors and an extra delay. Earlier generations used relays, vacuum tubes and diode-transistor and transistor-transistor logic (TTL); the 7400 chip, a package of four two-input NAND gates in the TTL family from Texas Instruments in the 1960s, was a staple of hobbyist and industrial design for decades.
Combining gates creates arithmetic, which is the leap from logic to computation. A half adder adds two single bits using just an XOR gate for the sum and an AND gate for the carry; two half adders plus an OR gate make a full adder that also accepts a carry-in, and chaining full adders produces a multi-bit adder, the heart of an arithmetic logic unit. Other standard assemblies include multiplexers that select one of several inputs, decoders that turn a binary number into one active line, and latches and flip-flops, which feed gate outputs back to inputs to remember a bit and thus create memory and the registers of a processor. Combinational circuits depend only on current inputs; sequential circuits add stored state and a clock.
NAND and NOR are called universal because either one alone can build every other gate. Wiring both inputs of a NAND together gives NOT, a NAND followed by that NOT gives AND, and De Morgan's laws give OR from inverted inputs. Designers and tools exploit this: the Apollo Guidance Computer of the 1960s was famously built from a single type of three-input NOR gate, and standard-cell chip libraries are heavy on NAND and NOR. Size is often quoted in "NAND2 equivalents", a unit counting how many two-input NAND gates would match a design's area; a modern processor contains billions of transistors, and design is done in hardware description languages such as Verilog and VHDL that a synthesis tool maps onto gates automatically.
Real gates are analog devices behaving digitally, and that gap matters. A gate does not output exactly 0 or 1 but a voltage within a defined range of each, with noise margins that let small disturbances be ignored; every gate takes a small but nonzero time to switch, its propagation delay, and the slowest chain of gates between two clocked registers (the critical path) is what limits the clock speed. Each switch also dissipates a little energy, so billions of gates toggling billions of times a second are the source of a chip's heat. A frequent misconception is that a gate "decides" like an if statement: a gate has no program, it is a fixed physical relationship, and a software conditional is eventually carried out by many gates arranged to behave that way.
Read a logic gate as one tiny, unchangeable rule written in silicon: stack enough of those rules in the right order and the result is addition, memory, and eventually a computer.