We describe a novel Monte Carlo code for photon migration through 3D media with spatially varying optical properties. The code is validated against analytic solutions of the photon diffusion equation for semi-infinite homogeneous media. The code is also cross-validated for photon migration through a slab with an absorbing heterogeneity. A demonstration of the utility of the code is provided by showing time-resolved photon migration through a human head. This code, known as ‘tMCimg’, is available on the web and can serve as a resource for solving the forward problem for complex 3D structural data obtained by MRI or CT.