We perform density-functional theory (DFT) calculations of carbon dissolution and diffusion in iron, the latter being a typical example of interstitial diffusion. The Kohn-Sham equations are solved with periodic boundary conditions and within the projector-augmented-wave formalism, using the generalized gradient approximation for electron exchange and correlation. With the solution enthalpy as an indication of cell size convergence, we find a supercell with 128 Fe atoms and one C atom is sufficient for describing dilute concentrations of carbon in bcc Fe. The solution enthalpy of carbon in an octahedral site in ferrite is predicted to be 0.74 eV, i.e., the dissolution of carbon in bcc ferromagnetic (FM) Fe is an endothermic process. Using the Fe128C1 periodic cell, we find that the minimum-energy path (MEP) of carbon diffusion from one octahedral site to another (via a tetrahedral site) has a barrier of 0.86 eV, in excellent agreement with the experimental value of 0.87 eV. This encouraging benchmark result prompted us to investigate carbon diffusion in austenite, whose electronic structure is less well characterized experimentally. Cell size convergence results show that a supercell with 32 Fe atoms and one C atom is sufficient. The calculated solution enthalpy is $\ensuremath{-}0.17$ eV, which indicates that the dissolution of carbon in fcc Fe is exothermic, consistent with the known greater solubility of C in austenite compared to ferrite. The MEP shows that carbon moves linearly from an octahedral site to another, contrary to the common notion of an off-plane diffusion path. The diffusion barrier is calculated to be 0.99 eV. Since we model austenite with the FM high-spin phase, the diffusion barrier we obtain is not directly comparable to the experiments in which austenite is usually paramagnetic. However, this prediction is relevant for C incorporation into Fe thin films, since FM high-spin fcc Fe can be obtained by epitaxial growth of thin Fe films on a Cu substrate.