The structural, electronic, magnetic and optical properties of Co-based Heusler compounds, Co2CrZ (Z = Si, Ge), are studied using first-principle density functional theory. The calculations are performed within the generalized gradient approximation. Our calculated structural parameters at 0 GPa agree well with previous available results. The calculated magnetic moment agrees well with the Slater–Pauling (SP) rule. We have studied the effect of pressure on the electronic and magnetic properties of Co2CrSi and Co2CrGe. With an increase in applied pressure, a decrease in cell volume is observed. Under application of external pressure, the valence band and conduction band are shifted downward which leads to a modification of electronic structure. There exists an indirect band gap along Γ–X for both the alloys. Co2CrSi and Co2CrGe retain 100% spin polarization up to 60 and 50 GPa, respectively. The local magnetic moments of the Co and Si (Ge) atoms increase with an increase in pressure whereas the local magnetic moment of the Cr atom decreases. In addition, the optical properties such as dielectric function, absorption spectra, optical conductivity and energy loss function of these alloys have also been investigated. To our knowledge this is the first theoretical prediction of the pressure dependence of the structural, electronic, magnetic and optical properties of Co2CrSi and Co2CrGe.