The accretion of the terrestrial planets from asteroid collisions and the delivery to the Earth of martian and lunar meteorites has been modelled extensively(1,2). Meteorites that have experienced shock waves from such collisions can potentially be used to reveal the accretion process at different stages of evolution within the Solar System. Here we have determined the peak pressure experienced and the duration of impact in a chondrite and a martian meteorite, and have combined the data with impact scaling laws to infer the sizes of the impactors and the associated craters on the meteorite parent bodies. The duration of shock events is inferred from trace element distributions between coexisting high-pressure minerals in the shear melt veins of the meteorites. The shock duration and the associated sizes of the impactor are found to be much greater in the chondrite (similar to 1 s and 5 km, respectively) than in the martian meteorite (similar to 10 ms and 100 m). The latter result compares well with numerical modelling studies of cratering on Mars, and we suggest that martian meteorites with similar, recent ejection ages (10(5) to 10(7) years ago)(3) may have originated from the same few square kilometres on Mars.