We present a novel framework to decompose three-nucleon forces in a momentum space partialwave basis. The new approach is computationally much more efficient than previous methods and opens the way to ab initio studies of few-nucleon scattering processes, nuclei and nuclear matter based on higher-order chiral 3N forces. We use the new framework to calculate matrix elements of chiral three-nucleon forces at N 2 LO and N 3 LO in large basis spaces and carry out benchmark calculations for neutron matter and symmetric nuclear matter. We also study the size of the individual three-nucleon force contributions for 3 H. For nonlocal regulators, we find that the sub-leading terms, which have been neglected in most calculations so far, provide important contributions. All matrix elements are calculated and stored in a user-friendly way, such that values of low-energy constants as well as the form of regulator functions can be chosen freely.