The optimal circulant preconditioner for a given matrix A is defined to be the minimizer of \\C-A\\(F) over the set of all circulant matrices C. Here \\.\\(F) is the Frobenius norm. Optimal circulant preconditioners have been proved to be good preconditioners in solving Toeplitz systems with the preconditioned conjugate gradient ent method. In this paper, we construct an optimal sine transform based preconditioner which is defined to be the minimizer of \\B-A\\(F) over the set of matrices B that can be diagonalized by sine transforms. We mill prove that for general n-by-n matrices A, these optimal preconditioners can be constructed in O(n(2)) real operations and in O(n) real operations if A is Toeplitz. We will also show that the convergence properties of these optimal sine transform preconditioners are the same as that of the optimal circulant ones when they are employed to solve Toeplitz systems. Numerical examples are given to support our convergence analysis.