system
Given the following post, respond as if you're commenting on Reddit:
human
Why are 12 volts and 5 volts such popular voltages for electronics?

Is there something intrinsically convenient about them, or is it just the standard we've been using forever so we keep using it?
gpt
There are many things that factor into both the historical choices of these these voltages and the continued use of them.

In the 1950s through 70s, roughly speaking, it was exciting that you could run a transistor circuit on voltage lower than the hundreds of volts used in vacuum tube circuits, both because of the reduced power consumption (for a given current level), because of the safety, and because of the feasibility of making a portable device.  In addition to 12 V, standard voltages included +/-15 V for high-performance instrumentation and 9 V for portable electronics.  The 9-V battery was (and still is) made by stacking six small 1.5-V cells.  It would have been easier to run on one or two single cells (like AA or C cells), but it was hard to make something run on a voltage that low given the electronics technology of the day.   One reason for 12 V was that that's the standard vehicular battery voltage, which was based on 2-V lead-acid battery cells: six stacked in series.  Some equipment could be powered from the car electrical system or from a 12-V power supply at home.

In the early development of digital logic circuits and ICs, different schemes used different supply voltages.  In the mid 1960s, Texas Instruments introduced the 7400 series of "TTL" (transitor-transistor logic) ICs, which became hugely popular and set the standard for digital logic for decades.  They chose 5 V as the supply voltage, and required a regulated constant voltage.  A single transistor requires at least about 0.7 V to turn on, but given the configurations of multiple transistors in a set of interconnected logic gates, and given the need to guarantee proper operation even with process variations in the crude processes of the day, and over temperature, 5 V allowed a design that gives adequate margin to be sure everything works right consistently.  A higher voltage would have allowed more margin, but at higher power consumption and power dissipation, so 5 V was a sensible design point.

The standardization around the 7400 series chips and the improved versions of them locked in 5 V as a standard.  12 V was used for other things.  Some systems had an unregulated 12 V power supply bus for general use, and used that as an input to a 5 V regulator that created a tightly regulated 5 V bus.

CMOS replaced TTL, and especially as CMOS technology advanced, operation at lower voltages became possible, and desirable.  Part of the story of how Moore's law advanced is the story of smaller features work with lower voltages to enable high density ICs.  3.3 V became a new standard, then 2.5, and now voltages around 1 V are common for the actual operation of the digital logic circuits.  The low voltage, combined with the high power that modern processors use when they are running all out means that huge currents are required.  So the new standard approach is to step down the voltage with a dc-to-dc converter right at the load (the end use of the power).  This is often 5 V to about 1 V, and often 12 V to about 1 V.  That means that the current supplied to the equipment, and the current traveling in the power distribution wires inside can be only about ~1/5 or ~1/12th what is consumed by the digital logic circuits.  So even though the logic itself no longer uses 5 V or 12 V, those are reasonable voltages to use for power supply and distribution, and can reasonably easily be stepped down the the voltages needed for the actual circuitry.  In modern electronics there are often many sub-systems running on different voltages, and many different dc-to-dc converters are used.