The problem of stability of periodic billiard trajectories in triangles is considered. The notion of stability means the preservation of a period and qualitative structure of a trajectory (its combinatorial type) for sufficiently small variations of a triangle. The geometric, algebraic and fan unfoldings are introduced for stable trajectories description. The new method of fan coding, using these unfoldings, is proposed. This method permits to simplify the stability analysis.