The need for ever-faster information processing requires exceptionally small devices that operate at frequencies approaching the terahertz and petahertz regimes. For the diagnostics of such devices, researchers need a spatiotemporal tool that surpasses the device under test in speed and spatial resolution. Consequently, such a tool cannot be provided by electronics itself. Here we show how ultrafast electron beam probe with terahertz-compressed electron pulses can directly sense local electro-magnetic fields in electronic devices with femtosecond, micrometre and millivolt resolution under normal operation conditions. We analyse the dynamical response of a coplanar waveguide circuit and reveal the impulse response, signal reflections, attenuation and waveguide dispersion directly in the time domain. The demonstrated measurement bandwidth reaches 10 THz and the sensitivity to electric potentials is tens of millivolts or −20 dBm. Femtosecond time resolution and the capability to directly integrate our technique into existing electron-beam inspection devices in semiconductor industry makes our femtosecond electron beam probe a promising tool for research and development of next-generation electronics at unprecedented speed and size.