Aims. We describe the photometric content of the second data release of the Gaia project (Gaia DR2) and its validation along with the quality of the data. Methods. The validation was mainly carried out using an internal analysis of the photometry. External comparisons were also made, but were limited by the precision and systematics that may be present in the external catalogues used. Results. In addition to the photometric quality assessment, we present the best estimates of the three photometric passbands. Various colour-colour transformations are also derived to enable the users to convert between the Gaia and commonly used passbands. Conclusions. The internal analysis of the data shows that the photometric calibrations can reach a precision as low as 2 mmag on individual CCD measurements. Other tests show that systematic effects are present in the data at the 10 mmag level.