A printed circuit board (PCB) functions as a substrate essential for interconnecting and securing electronic components. Its widespread integration is evident in modern electronic devices, spanning computers, cell phones, televisions, digital cameras, and diverse apparatus. Ensuring product quality mandates meticulous defect inspection, a task exacerbated by the heightened precision of contemporary circuit boards, intensifying the challenge of defect detection. Conventional algorithms, hampered by inefficiency and limited accuracy, fall short of usage benchmarks. In contrast, PCB defect detection algorithms rooted in deep learning hold promise for achieving heightened accuracy and efficiency, bolstered by their adeptness at discerning novel defect types. This review presents a comprehensive analysis of machine vision-based PCB defect detection algorithms, traversing the realms of machine learning and deep learning. It commences by contextualizing and elucidating the significance of such algorithms, followed by an extensive exploration of their evolution within the machine vision framework, encompassing classification, comparison, and analysis of algorithmic principles, strengths, and weaknesses. Moreover, the introduction of widely used PCB defect detection datasets and assessment indices enhances the evaluation of algorithmic performance. Currently, the detection accuracy can exceed 95% at an Intersection over Union (IoU) of 0.5. Lastly, potential future research directions are identified to address the existing issues in the current algorithm. These directions include utilizing Transformers as a foundational framework for creating new algorithms and employing techniques like Generative Adversarial Networks (GANs) and reinforcement learning to enhance PCB defect detection performance.