The numerical simulation has been carried out to investigate the effect of the endwall fence height on the secondary flow in compressor cascade.The results show that there is a counter-rotating streamwise vortex formed over the fence.With the increase of fence height,losses around the fence increase and the strength of crossflow decreases.The optimal fence height is 1/3 of the inlet boundary layer thickness, which can reduce the total energy loss by 9%.The computation and test results agree well.