The ample electrical power supply makes brake-by-wire technology more suitable for application in electric vehicles than in conventional vehicles. The fail-safe performance of a brake-by-wire system is a key factor regarding its application on production vehicles. A new control allocation algorithm for improving the fail-safe performance of an electric vehicle brake system is proposed. The electric vehicle is equipped with a four-wheel independent brake-by-wire and steer-by-wire system. The main objective of the algorithm is to maintain the vehicle braking performance as close to the desired level as possible by reallocating the control inputs to the actuators in cases of partial or full failure of the brake-by-wire system. The control algorithm is developed using a two degrees of freedom vehicle model. A pseudo control vector is calculated by a sliding mode controller to minimize the difference between the desired and actual vehicle motions. A pseudo-inverse controller then allocates the control inputs according to the pseudo control vector and the failure mode which is assumed to have been determined by some diagnostic algorithms. The control algorithm is evaluated in Matlab/Simulink. Cases of the brake-by-wire system's partial failure and full failure are all covered while performing the simulations. In cases of partial failure, the control algorithm reallocates the braking forces to the failure-free wheels and corrects the steering angles of the four wheels to compensate the yaw moment generated by the possible asymmetric braking. In the case of full failure, the wheels on each of the two axles are steered in opposite directions to generate braking forces. Simulation results show that the algorithm works effectively to ensure safe braking in case of brake system failures.