Kesterite Cu2ZnSnS4 (CZTS) and Cu2ZnSnSe4 (CZTSe) compounds are candidate low-cost absorber materials for thin-film solar cells, and a light-to-electricity efficiency as high as ~10% has been achieved in the solar cell based on their alloys, Cu2ZnSn(S,Se)4 (CZTSSe). In this paper, we discuss the crystal and electronic structure of CZTSSe alloys with different composition, showing that the mixed-anion alloys keep the kesterite cation ordering, and are highly miscible with a small band gap bowing parameter. The phase stability of CZTS and CZTSe relative to secondary compounds such as ZnS and Cu2SnS3 has also been studied, showing that chemical potential control is important for growing high-quality crystals, and the coexistence of these secondary compounds is difficult to be excluded using X-ray diffraction technique. Both CZTS and CZTSe are self-doped to p-type by their intrinsic defects, and the acceptor level of the dominant CuZn antisite is deeper than Cu vacancy. Relatively speaking, CZTSe has shallower acceptor level and easier n-type doping than CZTS, which gives an explanation to the high efficiency of CZTSSe based solar cells.