Searches through the code for areas it could be made more efficient, the aim is to make the code faster to execute although this stage can significantly add to the overall time taken for compilation, insignificant, redundant parts of code are detected and removed, repeated sections of code may be grouped and replaced with a more efficient piece of code