Beam-based setup of the LHC collimators is necessary to establish the beam centers and beam sizes at the collimator locations and determine the operational settings during various stages of the LHC machine cycle. Automatic software algorithms have been successful in reducing the costly beam time required for the alignment, as well as significantly reducing human error. In this paper, the beam-based alignment procedure is described, and the design of algorithms such as a BLM feedback loop, parallel collimator alignment, pattern recognition of BLM loss spikes, automatic loss threshold selection and coarse BPM-interpolation guided alignment is explained. A comparison on the alignment results from the 2010 to the 2012 LHC runs is presented to illustrate the improvements achieved with the automatic algorithms.peer-reviewe