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 desired outcome, often used in programming and mathematics. Algorithms are fundamental to computer science, enabling efficient data processing, problem-solving, and automation across various applications.