In this article, we discuss a Grobner basis algorithm related to the stability of algebraic varieties in the sense of Geometric Invariant Theory. We implement the algorithm with Macaulay 2 and use it to prove the stability of certain curves that play an important role in the log minimal model program for the moduli space of curves.