Abstract
The generation of large-scale magnetic fields is studied in the inflationary cosmology. We consider a very general situation in which the conformal invariance of the Maxwell field is violated through a coupling of the form IF2 where I can be a function of any non-trivial background fields that vary in time. We derive general formulae for the spectrum of large-scale magnetic fields and the spectral index. As a result, we obtain the general, model-independent necessary condition for the generation of magnetic fields with sufficiently large amplitude. Then the implications of our result are discussed.