Isolated photons at hadron colliders are defined by permitting only a limited amount of hadronic energy inside a fixed-size cone around the candidate photon direction. This isolation criterion admits contributions from collinear photon radiation off QCD partons and from parton-to-photon fragmentation processes. We compute the NNLO QCD corrections to isolated photon and photon-plus-jet production, including these two contributions. Our newly derived results allow us to reproduce the isolation prescription used in the experimental measurements, performing detailed comparisons with data from the LHC experiments. We quantify the impact of different photon isolation prescriptions, including no isolation at all, on photon-plus-jet cross sections and discuss possible measurements of the photon fragmentation functions at hadron colliders.