An algorithm is a step-by-step procedure or formula for solving a problem or completing a task. It consists of a finite sequence of well-defined instructions that can be followed to achieve a specific goal, often used in computer science for data processing and calculations. Algorithms can vary in complexity and are fundamental to programming, enabling efficient problem-solving and decision-making in various applications.