A comprehensive and hierarchical optimization of a joint hydrogen and syngas combustion mechanism has been carried out. The Kéromnès et al. (Combust Flame, 2013, 160, 995–1011) mechanism for syngas combustion was updated with our recently optimized hydrogen combustion mechanism (Varga et al., Proc Combust Inst, 2015, 35, 589–596) and optimized using a comprehensive set of direct and indirect experimental data relevant to hydrogen and syngas combustion. The collection of experimental data consisted of ignition measurements in shock tubes and rapid compression machines, burning velocity measurements, and species profiles measured using shock tubes, flow reactors, and jet‐stirred reactors. The experimental conditions covered wide ranges of temperatures (800–2500 K), pressures (0.5–50 bar), equivalence ratios (ϕ = 0.3–5.0), and C/H ratios (0–3). In total, 48 Arrhenius parameters and 5 third‐body collision efficiency parameters of 18 elementary reactions were optimized using these experimental data. A large number of directly measured rate coefficient values belonging to 15 of the reaction steps were also utilized. The optimization has resulted in a H2/CO combustion mechanism, which is applicable to a wide range of conditions. Moreover, new recommended rate parameters with their covariance matrix and temperature‐dependent uncertainty ranges of the optimized rate coefficients are provided. The optimized mechanism was compared to 19 recent hydrogen and syngas combustion mechanisms and is shown to provide the best reproduction of the experimental data.