Context : Aims : We present a framework to obtain photometric redshifts ( photo- z s ) for gamma-ray burst afterglows . Using multi-band photometry from GROND and Swift /UVOT , photo- z s are derived for five GRBs for which spectroscopic redshifts are not available . Methods : We use UV/optical/NIR data and synthetic photometry based on afterglow observations and theory to derive the photometric redshifts of GRBs and their accuracy . Taking into account the afterglow synchrotron emission properties , we investigate the application of photometry to derive redshifts in a theoretical range between z \sim 1 to z \sim 12 . Results : The measurement of photo- z s for GRB afterglows provides a quick , robust and reliable determination of the distance scale to the burst , particularly in those cases where spectroscopic observations in the optical/NIR range can not be obtained . Given a sufficiently bright and mildly reddened afterglow , the relative photo- z accuracy \eta = \Delta z / ( 1 + z ) is better than 10 % between z = 1.5 and z \sim 7 and better than 5 % between z = 2 and z = 6 . We detail the approach on 5 sources without spectroscopic redshifts observed with UVOT on-board Swift and/or GROND . The distance scale to those same afterglows is measured to be z = 4.31 ^ { +0.14 } _ { -0.15 } for GRB 080825B , z = 2.13 ^ { +0.14 } _ { -0.20 } for GRB 080906 , z = 3.44 ^ { +0.15 } _ { -0.32 } for GRB 081228 , z = 2.03 ^ { +0.16 } _ { -0.14 } for GRB 081230 and z = 1.28 ^ { +0.16 } _ { -0.15 } for GRB 090530 . Conclusions : Due to the exceptional luminosity and simple continuum spectrum of GRB afterglows , photometric redshifts can be obtained to an accuracy as good as \eta \sim 0.03 over a large redshift range including robust ( \eta \sim 0.1 ) measurements in the ultra-high redshift regime ( z \gtrsim 7 ) . Combining the response from UVOT with ground-based observatories and in particular GROND operating in the optical/NIR wavelength regime , reliable photo- z s can be obtained from z \sim 1.0 out to z \sim 10 , and possibly even at higher redshifts in some favorable cases , provided that these GRBs exist , are localized quickly , have sufficiently bright afterglows and are not heavily obscured .