CdS–TiO2 nanocomposites were prepared by a simple thermal decomposition approach. The effect of using four different types of TiO2 (as-prepared sol–gel TiO2 nanoparticles, sol–gel TiO2 after calcination at 500°C, sol–gel TiO2 after calcination at 700°C and macro-crystalline TiO2 ) on the structure, optical properties and photocatalytic activity of the nanocomposites was investigated. The nanocomposites were characterized by powder X-ray diffraction, field emission scanning electron microscopy coupled with energy dispersive X-ray analysis, transmission electron microscopy, diffuse reflectance spectroscopy and photoluminescence spectroscopy. The CdS–TiO2 nanocomposites consist of cubic CdS and anatase TiO2 nanocrystallites when as-prepared sol–gel TiO2 nanoparticles, sol–gel TiO2 calcined at 500°C and macro-crystalline TiO2 were used. On the other hand, when sol–gel TiO2 after calcination at 700°C was used, the nanocomposites were found to consist of rutile TiO2. TEM results indicate uniform distribution of CdS nanoparticles (10.5±1.6nm) on the TiO2 matrix in the nanocomposites prepared using as-prepared sol–gel TiO2 nanoparticles and sol–gel TiO2 after calcination at 500°C. In the nanocomposites, a blue shift of the band gap of CdS compared to bulk CdS is observed. The CdS–TiO2 nanocomposites act as good catalyst for the photodegradation of rhodamine B (RhB) and reduction of Cr(VI) in the presence of sunlight.