An algorithm is a step-by-step procedure or formula for solving a problem or performing a task. It consists of a sequence of instructions that can be followed to achieve a specific outcome, often used in computer programming and data processing. Algorithms can vary in complexity and are fundamental to computer science, mathematics, and various fields requiring logical problem-solving.