The stereo matching algorithms for binocular vision are very popular and widely applied. However, the algorithms may have lower matching quality or higher time complexity. To improve that, a new stereo matching algorithm based on square and gradient for binocular vision is proposed in the paper. It divides an image line into a serious of ranges with comparing the gradients of the points in left and right image lines. The best matching in each range is found based on the summery of squared differences. The algorithm inherits the high quality of gradient algorithm and high performance of SSD algorithm and meanwhile avoids the additive noise.