Shell model calculations are done to study the structure of neutron-rich carbon isotopes. For both even-A and odd-A neutron-rich carbon isotopes, the energy levels are strongly affected by the configuration mixing of valence neutrons. The calculated energy levels in the nucleus 17C are significantly improved compared with experimental values when the model space of the three valence neutrons is enlarged from pure v(0d5/2)3 configuration to full sd space. We also investigate the configuration mixing effect on the B(E2) values in even-even nuclei 16-20C.