The competitive ratio is a measure used in online algorithms to evaluate the performance of an algorithm by comparing its solution to the optimal offline solution. It provides a worst-case guarantee on the algorithm's performance, ensuring it performs within a certain factor of the best possible outcome even without complete information upfront.