This online calculator can determine if points are collinear for any number of points and any dimensions (2d, 3d, etc.)
Simply enter the coordinates of a point separated by space, one line per point. The example below checks the collinearity of three points in 2d space, and their coordinates are (1,2), (2,4) and (3,6). Formulas can be found below the calculator.
How to find if points are collinear
In coordinate geometry, in n-dimensional space, a set of three or more distinct points are collinear if and only if, the matrix of the coordinates of these vectors is of rank 1 or less. For example, given three points X = (x1, x2, ... , xn), Y = (y1, y2, ... , yn), and Z = (z1, z2, ... , zn), if the matrix
is of rank 1 or less, the points are collinear.1
Since this site already has the Matrix Rank calculator, it is used to determine rank of entered coordinates matrix, and if it equals to 1, points are collinear.
For the simplest case of three points in 2d space: with the matrix
you can apply this technique by checking maximum three minors for zero (you can stop as soon as you find non-zero minor)
Or you can use the equivalent definition of collinearity from the same Wikipedia page:
For every subset of three points X = (x1, x2, ... , xn), Y = (y1, y2, ... , yn), and Z = (z1, z2, ... , zn), if the matrix
is of rank 2 or less, the points are collinear.
In case of three points in 2d space with the matrix
they are collinear if and only if the determinant of the matrix is zero.