We determine the masses, the singlet and octet decay constants as well as the anomalous matrix elements of the η and η′ mesons in Nf = 2 + 1 QCD. The results are obtained using twenty-one CLS ensembles of non-perturbatively improved Wilson fermions that span four lattice spacings ranging from a ≈ 0.086 fm down to a ≈ 0.050 fm. The pion masses vary from Mπ = 420 MeV to 126 MeV and the spatial lattice extents Ls are such that LsMπ ≳ 4, avoiding significant finite volume effects. The quark mass dependence of the data is tightly constrained by employing two trajectories in the quark mass plane, enabling a thorough investigation of U(3) large-Nc chiral perturbation theory (ChPT). The continuum limit extrapolated data turn out to be reasonably well described by the next-to-leading order ChPT parametrization and the respective low energy constants are determined. The data are shown to be consistent with the singlet axial Ward identity and, for the first time, also the matrix elements with the topological charge density are computed. We also derive the corresponding next-to-leading order large-Nc ChPT formulae. We find F8 = 115.0(2.8) MeV, θ8 = −25.8(2.3)°, θ0 = −8.1(1.8)° and, in the $$ \overline{\mathrm{MS}} $$
MS
¯
scheme for Nf = 3, F0(μ = 2 GeV) = 100.1(3.0) MeV, where the decay constants read $$ {F}_{\eta}^8 $$
F
η
8
= F8 cos θ8, $$ {F}_{\eta \prime}^8 $$
F
η
′
8
= F8 sin θ8, $$ {F}_{\eta}^0 $$
F
η
0
= −F0 sin θ0 and $$ {F}_{\eta \prime}^0 $$
F
η
′
0
= F0 cos θ0. For the gluonic matrix elements, we obtain aη(μ = 2 GeV) = 0.0170(10) GeV3 and aη′(μ = 2 GeV) = 0.0381(84) GeV3, where statistical and all systematic errors are added in quadrature.