Purpose: In carbon ion beam radiotherapy, nuclear fragmentation in tissue leads to an attenuation of the primary particle flux and the build‐up of lighter projectile fragments. The radio‐biological effectiveness of these secondary particles differs from the primary ions. Therefore, fragmentation has to be considered in physical models used for therapy planning. While until now large apparatus have been used for ion spectroscopic measurements, we developed an experimental technique to measure lateral distributions of charged particles directly within or closely behind phantoms, using a small pixelated detector. Methods: Experiments were performed at the Heidelberg Ion‐Beam Therapy Center. A carbon ion pencil beam (∼5mm nominal width, E initial=271MeV/u) was directed towards a 12.7cm thick PMMA phantom. Secondary particles leaving the phantom were detected with the Timepix detector, placed perpendicular to the beam 5cm behind the phantom. The Timepix detector consists of a 300μm thick silicon sensor and a read‐out chip with 256×256 square pixels (55μm pitch). The high spatial resolution and the pixel‐wise energy calibration enable to determine the energy‐loss of individual particles in the sensitive layer. Together with pattern recognition analysis of characteristic particle traces in the detector, we are able to distinguish types of particles and discriminate the ion species. Results: Lateral distributions of events identified as being induced by hydrogen, helium and boron ions were determined. They show approximately Gaussian shaped profiles with FWHM values of 3.2mm (boron), 6.3mm (helium) and 13.1mm (hydrogen). These results are consistent with the expectation, that lighter fragments show wider distributions. Conclusions: We present a novel method to determine secondary charged particle distributions in heavy ion therapy directly within phantoms. The main advantage lies in the flexibility of the set‐up. The performance of the method is promising to enable fragment distributions measurements in a wide phase space in the future. Research carried out in frame of the Medipix Collaboration