A computational tool is described that can be used for designing magnetic focusing or defocusing systems. A fully three-dimensional classical trajectory Monte Carlo simulation has been developed. Ion trajectories are simulated in the presence of magnetic elements that can be modeled as any combination of current loops and current lines. Each current loop or line may be located anywhere in the system and oriented along any of the three coordinate axes. The configuration need not be axisymmetric. The solutions are obtained using normalized parameters, which can be used for easily scaling the results. Examples are provided of the utility of the code.