The paper presents a new general algorithm for calculating jet cross sections in arbitrary scattering processes to next-to-leading accuracy in perturbative QCD. The algorithm is based on the subtraction method, which uses new factorization formulae called dipole formulae. These formulae implement both the soft and collinear approximations in a Lorentz covariant way, allowing for smooth interpolation between the two. The corresponding dipole phase space obeys exact factorization, enabling the dipole contributions to be integrated analytically over the entire phase space. The authors provide explicit analytic results for any jet observable in any scattering or fragmentation process involving lepton, lepton-hadron, or hadron-hadron collisions. The necessary analytical formulae are provided to construct numerical programs for next-to-leading order QCD calculations, making the algorithm straightforwardly implementable in general-purpose Monte Carlo programs. The paper covers the general method, notation, factorization in the soft and collinear limits, dipole factorization formulae, QCD cross sections at NLO, and various applications, including jet cross sections with no initial-state hadrons, one initial-state hadron, one final-state identified hadron, and two initial-state hadrons. It also discusses multi-particle correlations and provides a summary and discussion of the results.The paper presents a new general algorithm for calculating jet cross sections in arbitrary scattering processes to next-to-leading accuracy in perturbative QCD. The algorithm is based on the subtraction method, which uses new factorization formulae called dipole formulae. These formulae implement both the soft and collinear approximations in a Lorentz covariant way, allowing for smooth interpolation between the two. The corresponding dipole phase space obeys exact factorization, enabling the dipole contributions to be integrated analytically over the entire phase space. The authors provide explicit analytic results for any jet observable in any scattering or fragmentation process involving lepton, lepton-hadron, or hadron-hadron collisions. The necessary analytical formulae are provided to construct numerical programs for next-to-leading order QCD calculations, making the algorithm straightforwardly implementable in general-purpose Monte Carlo programs. The paper covers the general method, notation, factorization in the soft and collinear limits, dipole factorization formulae, QCD cross sections at NLO, and various applications, including jet cross sections with no initial-state hadrons, one initial-state hadron, one final-state identified hadron, and two initial-state hadrons. It also discusses multi-particle correlations and provides a summary and discussion of the results.