The slope of a line is defined as the ratio of the vertical change to the horizontal change between any two points on the line. It is calculated by dividing the difference in y-coordinates by the difference in x-coordinates of two points on the line, represented as (y2 - y1) / (x2 - x1).