The Canvas miterLimit property controls how far a sharp miter join is allowed to extend. It matters only when lineJoin is set to miter. If a corner would create a miter longer than the allowed ratio, Canvas renders that corner as a bevel instead.
The default miterLimit is 10. The value must be at least 1.
<canvas id="myCanvas" width="360" height="220"></canvas>
<script>
const canvas = document.getElementById('myCanvas');
const ctx = canvas.getContext('2d');
ctx.lineWidth = 40;
ctx.lineJoin = 'miter';
ctx.miterLimit = 4;
ctx.beginPath();
ctx.moveTo(70, 190);
ctx.lineTo(180, 35);
ctx.lineTo(290, 190);
ctx.stroke();
</script>
A miter join is formed by extending the outside edges of two connected stroked segments until they meet. As the angle between the segments becomes sharper, that pointed extension becomes longer.
miterLimit sets the maximum allowed ratio between the miter length and the line width. When the required ratio exceeds the limit, the join is drawn as a bevel. This is why there is no universal rule such as “a value below 3 always produces a bevel”: the result depends on the angle of the path.

Move the slider to change miterLimit. At lower values the sharp corner may switch from a miter to a bevel; at higher values the pointed miter is allowed to extend farther.
The path angle is fixed so you can see where this particular corner changes between a miter and bevel.
The default value is 10. Use a finite number of 1 or greater. Values below 1, zero, negative numbers, Infinity, and NaN are ignored.
ctx.lineJoin = 'miter';
ctx.miterLimit = 10; // default
ctx.miterLimit = 4; // shorter miters allowed
ctx.miterLimit = 1; // effectively prevents pointed miters
Changing miterLimit has no visible effect when lineJoin is round or bevel.
ctx.lineJoin = 'miter';
ctx.miterLimit = 3;
// miterLimit does not control these join styles:
ctx.lineJoin = 'round';
ctx.lineJoin = 'bevel';
The visual length of a miter also changes with lineWidth. However, miterLimit itself is a ratio, which makes it useful across different stroke widths. The sharper the corner, the larger the ratio required to preserve the pointed miter.
ctx.lineWidth = 30;
ctx.lineJoin = 'miter';
ctx.miterLimit = 5;
ctx.strokeStyle = '#2457a6';
round or bevel line joins when you do not want pointed miters at all.miterLImit. JavaScript is case-sensitive; use miterLimit.3 applies to every path. The cutoff depends on the corner angle.miterLimit to affect round or bevel joins.1 and expecting it to be applied.stroke() and expecting already-rendered pixels to update.miterLimit changes only the visual rendering of Canvas strokes. If line shape, color, or geometry conveys information, provide the same meaning in accessible HTML text or another equivalent representation outside the Canvas bitmap.
The default value is 10.
The value must be at least 1.
The corner requires a miter ratio greater than the current miterLimit, so Canvas clips the pointed join to a bevel.
No. It is used only with lineJoin = 'miter'.
No. Whether the join changes to a bevel depends on the angle between the connected path segments and the required miter ratio.
Canvas tutorial | lineJoin | lineWidth | lineCap | strokeStyle | setLineDash()
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.