Optical power measurements are needed in practically all technologies based on light. Here, we report a general-purpose optical power detector based on the photoacoustic effect. Optical power incident on the detector's black absorber produces an acoustic signal, which is further converted into an electrical signal using a silicon-cantilever pressure transducer. We demonstrate an exceptionally large spectral coverage from ultraviolet to far infrared, with the possibility for further extension to the terahertz region. The linear dynamic range of the detector reaches 80 dB, ranging from a noise-equivalent power of 6 n W/H z to 600 mW (independent of signal averaging time).