The electronic structure and mechanical properties Of UC2 and U2C3 have been systematically investigated using first-principles calculations by the projector-augmented-wave (PAW) method. Furthermore, in order to describe precisely the strong on-site Coulomb repulsion among the localized U 5f electrons, we adopt the generalized gradient approximation +U formalisms for the exchange-correlation term. We show that our calculated structural parameters and electronic properties for UC2 and U2C3 are in good agreement with the experimental data by choosing an appropriate Hubbard U = 3 eV. As for the chemical bonding nature, the contour plot of charge density and total density of states suggest that UC2 and U2C3 are metallic mainly contributed by the 5f electrons, mixed with significant covalent component resulted from the strong C-C bonds. The present results also illustrate that the metal-carbon (U-C) bonding and the carbon-carbon covalent bonding in U2C3 are somewhat weaker than those in UC2, leading to the weaker thermodynamic stability at high temperature as observed by experiments.