GALFIT is a two-dimensional (2-D) fitting algorithm designed to extract structural components from galaxy images, with emphasis on closely modeling light profiles of spatially well-resolved, nearby galaxies observed with the Hubble Space Telescope. The algorithm improves on previous techniques in two areas: 1.) by being able to simultaneously fit a galaxy with an arbitrary number of components, and 2.) with optimization in computation speed, suited for working on large galaxy images. 2-D models such as the "Nuker'' law, the Sersic (de Vaucouleurs) profile, an exponential disk, and Gaussian or Moffat functions are used. The azimuthal shapes are generalized ellipses that can fit disky and boxy components. Many galaxies with complex isophotes, ellipticity changes, and position-angle twists can be modeled accurately in 2-D. When examined in detail, even simple-looking galaxies generally require at least three components to be modeled accurately rather than the one or two components more often employed. This is illustrated by way of seven case studies, which include regular and barred spiral galaxies, highly disky lenticular galaxies, and elliptical galaxies displaying various levels of complexities. A useful extension of this algorithm is to accurately extract nuclear point sources in galaxies.