We consider inflationary magnetogenesis where the conformal symmetry is broken by the term \(f^2(\phi) F_{\alpha\beta} F^{\alpha\beta}\). We assume that the magnetic field power spectrum on the observable range of scales today is a power law. This fixes \(f\) to be close to a power law in conformal time in the window during inflation when the modes observed today are generated. In contrast to previous work, we do not make any assumptions about the form of \(f\) outside this window, beyond avoiding strong coupling and large backreaction both at the background and perturbative level. We cover all possible reheating histories. We find the limit \(\delta_{B_0} < 5 \times10^{-15} \left( \frac{r}{0.07} \right)^{1/2} \kappa \mathrm{G}\) for the magnetic field today, where \(r\) is the tensor-to-scalar ratio and \(\kappa\) is a constant related to the form of \(f\). This estimate has an uncertainty of one order of magnitude related to our approximations. The parameter \(\kappa\) is \(<100\), and values \(\gtrsim1\) require a highly fine-tuned form of \(f\); typical values are orders of magnitude smaller.