Z-scan measurements of third-order optical nonlinearities are usually carried out with Gaussian beams. Good quality Gaussian beams are not readily available, however, and to overcome this limitation, we analyze the Z-scan experiment using top-hat beams. A graphical method is developed which allows straightforward determination of the nonlinear refraction and absorption coefficients from experimental data. The advantage of using top-hat beams is that it allows Z-scan measurements using a wide variety of laser sources, including dye lasers. Chi(3) values obtained using Z-scan measurements with top-hat and Gaussian beams are compared for the liquid crystal 5CB (4-cyano-4'-n-pentybiphenyl).