Context : Aims : We compute photometric redshifts in the fourth public release of the Canada-France-Hawaii Telescope Legacy Survey . This unique multi-colour catalogue comprises u ^ { * } ,g ^ { \prime } ,r ^ { \prime } ,i ^ { \prime } ,z ^ { \prime } photometry in four deep fields of 1 \deg ^ { 2 } each and 35 ~ { } \deg ^ { 2 } distributed over three Wide fields . Methods : Our photometric redshifts , computed using a template-fitting method , are calibrated with a large catalogue of 16,983 high-quality spectroscopic redshifts from several spectroscopic surveys . Results : From the comparison with spectroscopic redshifts , we find a photometric redshift dispersion of 0.028 and an outlier rate of 3.5 % in the Deep field at i ^ { \prime } _ { AB } < 24 . In the Wide fields , we find a dispersion of 0.036 and outlier rate of 2.8 % at i ^ { \prime } _ { AB } < 22.5 . Beyond i ^ { \prime } _ { AB } = 22.5 in the Wide fields the number of outliers rises from 5 % to 10 % at i ^ { \prime } _ { AB } < 23 and i ^ { \prime } _ { AB } < 24 respectively . For the Wide sample , we find the systematic redshift bias keeps below 1 % to i ^ { \prime } _ { AB } < 22.5 , whereas we find no significant bias in the Deep field . We investigated the effect of tile-to-tile photometric variations and demonstrate that the accuracy of our photometric redshifts is reduced by at most 21 % . We separate stars from galaxies using both the size and colour information . Applying our star-galaxy classifier we reduce the contamination by stars in our catalogues from 50 % to 8 % at i ^ { \prime } _ { AB } < 22.5 in our field with the highest stellar density while keeping a complete galaxy sample . Our CFHTLS T0004 photometric redshifts are distributed to the community . Our release include 592 , 891 ( i ^ { \prime } _ { AB } < 22.5 ) and 244 , 701 ( i ^ { \prime } _ { AB } < 24 ) reliable galaxy photometric redshifts in the Wide and Deep fields , respectively . Conclusions :