The temporal shape of a pulse in transcranial magnetic stimulation (TMS) influences which neuron populations are activated preferentially as well as the strength and even direction of neuromodulation effects. Furthermore, various pulse shapes differ in their efficiency, coil heating, sensory perception, and clicking sound. However, the available TMS pulse shape repertoire is still very limited to a few biphasic, monophasic, and polyphasic pulses with sinusoidal or near-rectangular shapes. Monophasic pulses, though found to be more selective and stronger in neuromodulation, are generated inefficiently and therefore only available in simple low-frequency repetitive protocols. Despite a strong interest to exploit the temporal effects of TMS pulse shapes and pulse sequences, waveform control is relatively inflexible and only possible parametrically within certain limits. Previously proposed approaches for flexible pulse shape control, such as through power electronic inverters, have significant limitations: The semiconductor switches can fail under the immense electrical stress associated with free pulse shaping, and most conventional power inverter topologies are incapable of generating smooth electric fields or existing pulse shapes. Leveraging intensive preliminary work on modular power electronics, we present a modular pulse synthesizer (MPS) technology that can, for the first time, flexibly generate high-power TMS pulses (one-side peak ~ 4,000 V, ~ 8,000 A) with user-defined electric field shape as well as rapid sequences of pulses with high output quality. The circuit topology breaks the problem of simultaneous high power and switching speed into smaller, manageable portions, distributed across several identical modules. In consequence, MPS TMS can use semiconductor devices with voltage and current ratings lower than the overall pulse voltage and distribute the overall switching of several hundred kilohertz among multiple transistors. MPS TMS can synthesize practically any pulse shape, including conventional ones, with fine quantization of the induced electric field (≤ 17% granularity without modulation and ~300 kHz bandwidth). Moreover, the technology allows optional symmetric differential coil driving so that the average electric potential of the coil, in contrast to conventional TMS devices, stays constant to prevent capacitive artifacts in sensitive recording amplifiers, such as electroencephalography (EEG). MPS TMS can enable the optimization of stimulation paradigms for more sophisticated probing of brain function as well as stronger and more selective neuromodulation, further expanding the parameter space available to users.