We optimized the baseline length of SQUID-based symmetric axial gradiometers using a computer simulation. The signal-to-noise ratio (SNR) was used as the optimization criteria. We found that in most cases the optimal baseline is not equal to the depth of the primary source, rather it has a more complex dependence on the gradiometer balance and the ambient magnetic noise. We studied both first and second order gradiometers in simulated shielded environments and second order gradiometers in a simulated unshielded environment. The noise source was simulated as a distant dipolar source for the shielded case. We present optimal gradiometer baseline lengths for the various simulated situations.