An algorithm is a step-by-step procedure or formula for solving a problem or completing a task, often used in computing and mathematics. It consists of a finite sequence of instructions that can be followed to achieve a specific outcome, such as sorting data or performing calculations. Algorithms can vary in complexity and efficiency, and are fundamental to computer programming and data processing.