Add labeled points and see the SVM decision boundary — the line that maximizes the margin between classes.
Click to add points of the selected class. The boundary updates automatically using a simplified max-margin approximation.
Support Vector Machines take a distinctive approach to classification, rather than just finding any boundary that separates two classes, SVM specifically finds the boundary that maximizes the margin, the distance between the boundary and the nearest points from each class. In the visualization above, the solid dark line is the decision boundary, and the dashed lines mark the edges of the margin, the widest possible "no man's land" between the two classes that the boundary sits exactly in the middle of.
Among all the possible lines that could separate two classes correctly, a line squeezed right up against one class's points is intuitively riskier than one sitting comfortably in the middle, a new, slightly different data point is more likely to be misclassified by a boundary with a thin margin than one with a wide margin. SVM formalizes this intuition mathematically, explicitly optimizing for the boundary with the largest possible margin, which tends to generalize better to new, unseen data than an arbitrarily-placed separating line would.
Here's the detail that gives Support Vector Machines their name, the position of the decision boundary is determined entirely by the points closest to it, the "support vectors" (highlighted with a darker outline in the visualization). Every other point, no matter how far from the boundary, could be moved, removed, or duplicated without changing the boundary's position at all, only the support vectors matter for defining where the line sits. This is fundamentally different from something like logistic regression, where every single data point contributes to the fitted boundary.
Try clicking points that overlap between classes, real classification boundaries are rarely as cleanly separable as this demo's default random data. Real-world SVM implementations handle this with two key extensions this simplified visualizer doesn't cover, a "soft margin" that allows some points to fall on the wrong side of the boundary in exchange for a wider, more generalizable margin overall, and the "kernel trick," which projects data into a higher-dimensional space where a linear boundary in that new space corresponds to a curved, non-linear boundary in the original space, letting SVM handle data that's fundamentally not linearly separable in its original form.
Despite neural networks dominating headlines, SVM remains a strong, reliable choice for smaller datasets with clear margins between classes, text classification tasks, bioinformatics (gene classification), and image classification problems where the number of features is large relative to the number of training examples, situations where SVM's margin-maximizing approach and resistance to overfitting on smaller datasets genuinely outperform more data-hungry deep learning approaches.