Fractionalization is a phenomenon in which strong interactions in a quantum system drive the emergence of excitations with quantum numbers that are absent in the building blocks. Outstanding examples are excitations with charge e/3 in the fractional quantum Hall effect, solitons in one-dimensional conducting polymers and Majorana states in topological superconductors. Fractionalization is also predicted to manifest itself in low-dimensional quantum magnets, such as one-dimensional antiferromagnetic S = 1 chains. The fundamental features of this system are gapped excitations in the bulk and, remarkably, S = 1/2 edge states at the chain termini, leading to a four-fold degenerate ground state that reflects the underlying symmetry-protected topological order. Here, we use on-surface synthesis to fabricate one-dimensional spin chains that contain the S = 1 polycyclic aromatic hydrocarbon triangulene as the building block. Using scanning tunneling microscopy and spectroscopy at 4.5 K, we probe length-dependent magnetic excitations at the atomic scale in both open-ended and cyclic spin chains, and directly observe gapped spin excitations and fractional edge states therein. Exact diagonalization calculations provide conclusive evidence that the spin chains are described by the S = 1 bilinear-biquadratic Hamiltonian in the Haldane symmetry-protected topological phase. Our results open a bottom-up approach to study strongly correlated quantum spin liquid phases in purely organic materials, with the potential for the realization of measurement-based quantum computation.