Abstract. A comprehensive model atom for non-LTE line-formation calculations for neutral and singly-ionized carbon is presented. Highly accurate radiative and collisional atomic data are incorporated, recently determined for astrophysical and fusion research using the R-matrix method in the close-coupling approximation. As a test and first application of the model, carbon abundances are determined on the basis of line-blanketed LTE model atmospheres for five stars, the main sequence object Vega (A0 V) and the supergiants η Leo (A0 Ib), HD 111613 (A2 Iabe), HD 92207 (A0 Iae) and β Ori (B8 Iae), using high S/N and high-resolution spectra at visual and near-IR wavelengths. The computed non-LTE line profiles fit the observations well for a single carbon abundance in each object. For two supergiants, η Leo and HD 111613, lines of both species are simultaneously present in the spectra, giving consistent C i and C ii abundances (within the error bars). However, the uncertainties of the abundances are large, on the order of ∼0.3 dex (statistical + systematical error), thus the ionization equilibrium of C i/ii is of restricted use for the determination of stellar parameters. All supergiants within our sample show a depletion of carbon on the order of 0.2-0.5 dex, indicating the mixing of CN-cycled material into the atmospheric layers, with the sum of the CNO abundances remaining close to solar. This finding is in accordance with recent stellar evolution models accounting for mass-loss and rotation. For Vega, an underabundance of carbon by 0.3 dex is found, in excellent agreement with the similar underabundance of other light elements. The dependence of the non-LTE effects on the atmospheric parameters is discussed and the influence of systematic errors is estimated. Special emphasis is given to the supergiants where a strong radiation field at low particle densities favours deviations from LTE. Non-LTE effects systematically strengthen the C i/ii lines. For the C i lines in the infrared, a strong sensitivity to modifications in the photoionization and collisional excitation data is found. An increasing discrepancy between our model predictions and the observations for the C ii doublet λλ 6578-82 is perceived with rising luminosity, while the other C ii doublet and quartet lines remain consistent. Furthermore, the influence of microturbulence on the statistical-equilibrium calculations is investigated.