Confirmation bias has been traditionally seen as a detrimental aspect of the human mind, but recently researchers have also argued that it might be advantageous under certain circumstances, e.g. when coupled with meta cognition or as a means to arrive at a cognitive division of labor. To test if confirmation bias can improve performance in a perception task, we developed a minimally complex agent-based model in which agents detect binary signals. In our model, biased agents have -compared to unbiased agents -a higher chance to detect the signal they are biased for, and a lower chance to detect other signals. Additionally, detecting signals is associated with benefits, while missing signals is associated with costs. Given these basic model assumptions, biased agents perform better than unbiased agents in a wide variety of possible scenarios. Thus, we can show that confirmation bias increases the fitness of agents and we use an evolutionary algorithm to find optimal bias strengths which make them more successful at detecting signals. We conclude that confirmation bias sensitizes agents towards a certain type of data, which allows them to detect more signals. We discuss our findings in relation to topics such as polarization of opinions, the persistence of first impressions, and the social theory of reasoning.