A Matlab-based Monte Carlo algorithm for transport of gamma-rays in matter. Transport of gamma photons in many fields such as radiation detection, dosimetry, and treatment planning is used. The transport of 1 MeV and 5 MeV photons in a water phantom was simulated by using the Monte Carlo algorithm in Matlab work space. The result of KERMA calculation showed good agreement with [{it F. Arqueros} and {it G. D. Montesinos}, “A simple algorithm for the transport of gamma rays in a medium”, Am. J. Phys. 71, No. 1, 38--45 (2003; url{doi:10.1119/1.1509416})] and MCNP4C. The proposed algorithm has the ability to read out from different cross section libraries. As the future work, it also can be extended for the electron and visible photon transport.