A comprehensive database of experimental and computed data for the viscosity of carbon dioxide (CO2) was compiled and a new reference correlation was developed. Literature results based on an ab initio potential energy surface were the foundation of the correlation of the viscosity in the limit of zero density in the temperature range from 100 K to 2000 K. Guided symbolic regression was employed to obtain a new functional form that extrapolates correctly to T → 0 K and to 10 000 K. Coordinated measurements at low density made it possible to implement the temperature dependence of the Rainwater-Friend theory in the linear-in-density viscosity term. The residual viscosity could be formulated with a scaling term ργ/T the significance of which was confirmed by symbolic regression. The final viscosity correlation covers temperatures from 100 K to 2000 K for gaseous CO2, and from 220 K to 700 K with pressures along the melting line up to 8000 MPa for compressed and supercritical liquid states. The data representation is more accurate than with the previous correlations, and the covered pressure and temperature range is significantly extended. The critical enhancement of the viscosity of CO2 is included in the new correlation.