We present the SWIRE Photometric Redshift Catalogue, 1025119 redshifts of unprecedented reliability and accuracy. Our method is based on fixed galaxy and QSO templates applied to data at 0.36-4.5 mu, and on a set of 4 infrared emission templates fitted to infrared excess data at 3.6-170 mu. The code involves two passes through the data, to try to optimize recognition of AGN dust tori. A few carefully justified priors are used and are the key to supression of outliers. Extinction, A_V, is allowed as a free parameter. We use a set of 5982 spectroscopic redshifts, taken from the literature and from our own spectroscopic surveys, to analyze the performance of our method as a function of the number of photometric bands used in the solution and the reduced chi^2. For 7 photometric bands the rms value of (z_{phot}-z_{spec})/(1+z_{spec}) is 3.5%, and the percentage of catastrophic outliers is ~1%. We discuss the redshift distributions at 3.6 and 24 mu. In individual fields, structure in the redshift distribution corresponds to clusters which can be seen in the spectroscopic redshift distribution. 10% of sources in the SWIRE photometric redshift catalogue have z >2, and 4% have z>3, so this catalogue is a huge resource for high redshift galaxies. A key parameter for understanding the evolutionary status of infrared galaxies is L_{ir}/L_{opt}, which can be interpreted as the specific star-formation rate for starbursts. For dust tori around Type 1 AGN, L_{tor}/L_{opt} is a measure of the torus covering factor and we deduce a mean covering factor of 40%.