- We study numerically in detail the behaviour of electrons in the strongly inhomogeneous static magnetic and electric fields, which are typical for thin quasiperpendicular collisionless shocks. We pay particular attention to the dependence of the final electron velocities on their initial velocities, for different shock widths. Electrons are completely magnetized when the shock is wide, but become demagnetized, and the energies that they acquire rapidly increase with the steepening of the field structure. One of the clear manifestations of the electron demagnetization is the loss of even approximate one-to-one correspondence of the downstream perpendicular velocity to the upstream perpendicular velocity. Electron reflection occurs despite the large cross-shock potential which accelerates electrons along the magnetic field (the regime of complete magnetization) or across the shock (strong demagnetization). The reflected ion fraction is sensitive to the potential, magnetic field jump, and ramp width.