Many Fourier-domain optical coherence tomography (FD-OCT) systems sample the interference fringes with a non-uniform wavenumber (k) interval, introducing a chirp to the signal that depends on the path length difference underlying each fringe. A dispersion imbalance between sample and reference arms also generates a chirp in the fringe signal which, in contrast, is independent of depth. Fringe interpolation to obtain a signal linear in k and compensate dispersion imbalance is critical to achieving bandwidth-limited axial resolution. In this work, we propose an optimization-based algorithm to perform robust and automated calibration of FD-OCT systems, recovering both the interpolation function and the dispersion imbalance. Our technique relies on the fact that the unique function that correctly linearizes the fringe data in k space produces a depth-independent chirp. The calibration procedure requires experimental data corresponding to a single reflector at various depth locations, which can easily be obtained by acquiring data while moving a sample mirror in depth. We have tested both spectral domain OCT and swept source OCT systems with various nonlinearities. Results indicate that the proposed calibration method has excellent performance on a wide range of data sets and enables nearly constant resolution at all imaging depths. An implementation of the algorithm is available online.