In this paper, a numerical algorithm for computing grazing bifurcation of periodic orbit in autonomous planar systems is derived and analyzed. We propose an analytical condition which to ensure the orbit quadratically intersects the switching manifold. Based upon this, we take into a new phase condition which ensure there is a branch of periodic orbits. The nondegenerate condition with respect to its bifurcation parameter is presented to ensure the defining equation well posed. A numerical simulation is carried out for the bifurcation diagram of the van der pol system, which agrees with analytical results very well.