Cyclic codes are an important subclass of linear codes and have wide applications in consumer electronics, data storage systems and communication systems as they have efficient encoding and decoding algorithms. In this paper, two families of optimal ternary cyclic codes with parameters [3 m − 1, 3 m − 2m − 1, 4] are presented. The first family of cyclic codes with two zeros π and π v is constructed by using multivariate method. The second family of cyclic codes with two zeros π 2 and π v is obtained by analyzing irreducible factors of certain polynomials with finite degrees over the finite field F 3 m , where π is a generator of F * 3 m .INDEX TERMS Cyclic codes, optimal codes, finite fields, irreducible polynomials.