CSS stroke-miterlimit Property

The CSS stroke-miterlimit property limits how far a pointed corner can extend when two segments of an SVG stroke meet.

It works with stroke-linejoin to prevent excessively long, sharp corners. When a miter join exceeds the specified limit, the browser changes the join to a bevel or clips the extension, depending on the selected line join style.

stroke-miterlimit Syntax

The stroke-miterlimit property accepts a unitless number greater than or equal to 1.

Basic Syntax

svg path {
  stroke-miterlimit: 4;
}

Common Values

svg path {
  stroke-miterlimit: 1;
}
svg path {
  stroke-miterlimit: 2;
}
svg path {
  stroke-miterlimit: 4;
}
svg path {
  stroke-miterlimit: 10;
}
svg path {
  stroke-miterlimit: 1.5;
}

CSS-Wide Keywords

svg path {
  stroke-miterlimit: initial;
}
svg path {
  stroke-miterlimit: inherit;
}
svg path {
  stroke-miterlimit: unset;
}
svg path {
  stroke-miterlimit: revert;
}
svg path {
  stroke-miterlimit: revert-layer;
}

The initial value is 4. Higher values permit longer pointed corners, while lower values restrict them.

Property Values

Value Description
<number> A unitless number greater than or equal to 1 that specifies the maximum permitted miter ratio.
initial Resets the property to 4.
inherit Uses the computed miter limit from the parent element.
unset Uses the inherited value because the property is inherited.
revert Reverts the property according to CSS cascade origin rules.
revert-layer Reverts the property according to CSS cascade layer rules.

Property Characteristics

Characteristic Value
Initial value 4
Inherited Yes
Applies to Applicable SVG shapes, paths, and text elements
Computed value As specified
Animation type By computed value type
Percentages Not applicable
Related properties stroke-linejoin, stroke-width, stroke
Specification SVG 2

Valid Examples

svg path {
  stroke-miterlimit: 1;
}
svg polygon {
  stroke-miterlimit: 2;
}
svg polyline {
  stroke-miterlimit: 4;
}
svg path {
  stroke-miterlimit: 10;
}
svg path {
  stroke-miterlimit: calc(2 + 2);
}

Invalid Examples

svg path {
  stroke-miterlimit: 0;
}
svg path {
  stroke-miterlimit: -2;
}
svg path {
  stroke-miterlimit: 10px;
}
svg path {
  stroke-miterlimit: 50%;
}
svg path {
  stroke-miterlimit: auto;
}

Values below 1, negative numbers, lengths, percentages, and unsupported keywords are invalid.

How It Works

When two connected SVG path segments meet at an angle, a miter join extends their outer stroke edges until they intersect.

At sharp angles, this intersection can be far from the original corner. The stroke-miterlimit property prevents the extension from becoming excessively long.

Step 1: Create an Angled Path

<svg viewBox="0 0 240 140">
  <path d="M30 120 L120 20 L210 120"/>
</svg>

Step 2: Apply a Miter Join

path {
  fill: none;
  stroke: #2563eb;
  stroke-width: 16;
  stroke-linejoin: miter;
}

The stroke creates a pointed join where the two segments meet.

Step 3: Set the Miter Limit

path {
  fill: none;
  stroke: #2563eb;
  stroke-width: 16;
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
}

If the corner's miter ratio exceeds 2, the browser renders that join as a bevel instead of a point.

Complete SVG Example

<svg viewBox="0 0 240 140" role="img" aria-label="Blue angled path with a limited pointed corner">
  <path d="M30 120 L120 20 L210 120" fill="none" stroke="#2563eb" stroke-width="16" stroke-linejoin="miter" stroke-miterlimit="2"/>
</svg>

Important Consideration

The miter limit changes only the painted corner. It does not modify the path coordinates, the angle between segments, or the stroke width.

Understanding the Miter Ratio

The miter ratio describes how far a pointed join extends relative to the stroke width.

Miter Ratio Formula

Miter ratio = Miter length / Stroke width

The miter length is measured from the outer tip of the pointed join to the inner intersection of the stroke edges.

Relationship to the Corner Angle

For two straight segments meeting at an interior angle, the ratio can also be calculated using:

Miter ratio = 1 / sin(angle / 2)

As the angle becomes smaller, the miter ratio increases. This means sharper corners require a higher miter limit to preserve their pointed appearance.

Example Ratios

Interior Angle Approximate Miter Ratio
120 degrees 1.15
90 degrees 1.41
60 degrees 2.00
30 degrees 3.86
20 degrees 5.76
10 degrees 11.47

Default Miter Limit

With the default stroke-miterlimit: 4, a miter join is retained when its ratio does not exceed 4. Sharper corners with larger ratios are beveled.

Important Consideration

The miter limit is a ratio, not a pixel measurement. It scales with the stroke width.

Comparing Miter Limit Values

Different miter limits determine how sharp a corner can become before its pointed extension is removed.

Minimum Limit

.minimum-miter {
  stroke-linejoin: miter;
  stroke-miterlimit: 1;
}

A limit of 1 causes ordinary angled corners to use bevel joins because their miter ratios exceed the limit.

Low Limit

.low-miter {
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
}

A limit of 2 preserves many wider corners but bevels sharper ones.

Default Limit

.default-miter {
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}

The default value allows pointed joins at moderately sharp angles.

High Limit

.high-miter {
  stroke-linejoin: miter;
  stroke-miterlimit: 10;
}

A higher limit preserves longer pointed extensions at sharper angles.

Value Comparison

Value Typical Effect
1 Bevels ordinary angled miter joins.
2 Limits sharper corners.
4 Default balance between pointed joins and excessive extensions.
10 Allows longer pointed corners.
20 Allows very long extensions at sharp angles.

Choosing a Value

Use a lower limit when long pointed extensions would interfere with nearby graphics. Use a higher limit when preserving sharp geometric corners is important.

Using stroke-linejoin

The stroke-miterlimit property works with specific values of stroke-linejoin.

Miter Joins

.miter-corner {
  stroke-linejoin: miter;
  stroke-miterlimit: 3;
}

If the miter ratio exceeds 3, the browser changes the join to a bevel.

Miter-Clip Joins

.clipped-corner {
  stroke-linejoin: miter-clip;
  stroke-miterlimit: 3;
}

With miter-clip, the pointed extension is clipped at the limit instead of changing to a bevel join. This SVG 2 join style has limited browser support.

Round Joins

.round-corner {
  stroke-linejoin: round;
  stroke-miterlimit: 2;
}

The miter limit does not affect rounded joins.

Bevel Joins

.bevel-corner {
  stroke-linejoin: bevel;
  stroke-miterlimit: 10;
}

The miter limit does not affect bevel joins.

Property Comparison

stroke-linejoin Value Effect of stroke-miterlimit
miter Changes the join to bevel when the ratio exceeds the limit.
miter-clip Clips the pointed extension at the limit.
round No effect.
bevel No effect.

Important Consideration

For reliable browser compatibility, use stroke-linejoin: miter with stroke-miterlimit. The miter-clip value is not consistently supported.

Sharp Angles and Stroke Width

Sharp angles and thick strokes make the effects of stroke-miterlimit easier to see.

Sharp Corner With a High Limit

.sharp-point {
  fill: none;
  stroke: #2563eb;
  stroke-width: 20;
  stroke-linejoin: miter;
  stroke-miterlimit: 10;
}

The high limit allows the pointed join to extend farther beyond the corner.

Sharp Corner With a Low Limit

.limited-point {
  fill: none;
  stroke: #2563eb;
  stroke-width: 20;
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
}

The lower limit prevents an excessively long pointed extension by switching the join to bevel when necessary.

Thin Stroke

.thin-miter {
  stroke-width: 2;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}

The pointed extension is relatively small because the stroke is thin.

Thick Stroke

.thick-miter {
  stroke-width: 24;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}

The same corner angle produces a larger visible extension when the stroke is thicker.

Does Stroke Width Change the Ratio?

No. For a given corner angle, the miter ratio remains the same regardless of stroke width. Increasing the stroke width increases the actual size of the pointed extension.

Avoiding Viewport Clipping

Long miter joins may extend outside the SVG viewport. Leave enough space around the path or adjust its viewBox to accommodate the painted stroke.

Practical Examples

Limit Sharp Icon Corners

.outline-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
}

Prevents long pointed extensions on small SVG icons.

Preserve Geometric Corners

.geometric-shape {
  fill: none;
  stroke: #2563eb;
  stroke-width: 8;
  stroke-linejoin: miter;
  stroke-miterlimit: 8;
}

Allows longer pointed corners on geometric outlines.

Bevel Sharp Polygon Corners

.limited-polygon {
  fill: none;
  stroke: #0d9488;
  stroke-width: 12;
  stroke-linejoin: miter;
  stroke-miterlimit: 1.5;
}

Uses a low limit to bevel sharper polygon corners.

Default Miter Limit

.default-outline {
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}

Uses the standard miter limit.

Clipped Miter Extension

.clipped-outline {
  stroke-linejoin: bevel;
}
@supports (stroke-linejoin: miter-clip) {
  .clipped-outline {
    stroke-linejoin: miter-clip;
    stroke-miterlimit: 3;
  }
}

Provides a bevel fallback for browsers that do not recognize miter-clip. Recognition alone does not guarantee correct rendering.

Inherited Miter Limit

.svg-group {
  stroke: #a855f7;
  stroke-width: 6;
  stroke-linejoin: miter;
  stroke-miterlimit: 3;
}

Child SVG elements inherit the miter limit unless they specify another value.

Reset the Miter Limit

.reset-miter {
  stroke-miterlimit: initial;
}

Restores the initial value of 4.

stroke-miterlimit Example

This example compares three identical sharp SVG paths with different miter limits. Each path has the same stroke width and corner angle, making the effect of the miter limit easy to see.

HTML Example

<div class="stroke-miterlimit-demo">
  <svg viewBox="0 0 600 240" role="img" aria-label="Three sharp SVG paths showing beveled and pointed corners at different miter limits">
    <path class="miter-low" d="M40 195 L100 35 L160 195"/>
    <path class="miter-default" d="M240 195 L300 35 L360 195"/>
    <path class="miter-high" d="M440 195 L500 35 L560 195"/>
  </svg>
</div>

CSS Example

.stroke-miterlimit-demo svg {
  display: block;
  width: 100%;
  height: auto;
}
.stroke-miterlimit-demo path {
  fill: none;
  stroke-width: 20;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
.stroke-miterlimit-demo .miter-low {
  stroke: #2563eb;
  stroke-miterlimit: 1;
}
.stroke-miterlimit-demo .miter-default {
  stroke: #0d9488;
  stroke-miterlimit: 4;
}
.stroke-miterlimit-demo .miter-high {
  stroke: #a855f7;
  stroke-miterlimit: 10;
}
Browser Result

The blue path uses a low miter limit and has a beveled corner. The teal and purple paths retain pointed corners because their miter limits exceed the corner's miter ratio.

Comparing the Results

Path Miter Limit Appearance
Blue 1 Beveled corner
Teal 4 Pointed corner
Purple 10 Pointed corner

Changing the Default Limit

.stroke-miterlimit-demo .miter-default {
  stroke-miterlimit: 2;
}

Reducing the teal path's miter limit to 2 causes its corner to become beveled.

Increasing the Stroke Width

.stroke-miterlimit-demo path {
  stroke-width: 30;
}

The pointed extensions become larger, but the miter ratio remains unchanged.

Changing the Join Style

.stroke-miterlimit-demo path {
  stroke-linejoin: round;
}

All three paths use rounded joins, and their different miter limits no longer affect the visible corners.

Creating a Sharper Angle

Moving the lower endpoints closer together while keeping the upper point fixed creates a sharper corner. The miter ratio increases, potentially causing additional joins to become beveled.

Accessibility Considerations

Miter limits can affect the clarity of SVG icons, diagrams, and geometric graphics, particularly at small display sizes.

Avoid Excessively Long Points

Sharp miter extensions may overlap nearby elements or make outlines difficult to interpret. Use an appropriate limit to keep corners controlled.

Maintain Sufficient Contrast

Ensure stroked shapes remain distinguishable from their backgrounds.

Choose Appropriate Stroke Widths

Very thin strokes can be difficult to see, while thick strokes can create large corner extensions. Test graphics at their intended sizes.

Provide Accessible SVG Names

Informative SVG graphics should include accessible names or equivalent descriptions.

<svg viewBox="0 0 200 120" role="img" aria-label="Blue triangular outline with limited pointed corners">
  <path d="M20 100 L100 20 L180 100 Z" fill="none" stroke="blue" stroke-width="10" stroke-linejoin="miter" stroke-miterlimit="2"/>
</svg>

Avoid Style-Only Meaning

Do not rely solely on pointed or beveled corners to communicate important information. Provide labels or additional visual cues when necessary.

Test at Different Sizes

Verify that SVG corners remain clear when graphics are resized, zoomed, or displayed on high-density screens.

Common Mistakes

Using a Value Below One

svg path {
  stroke-miterlimit: 0.5;
}

The property requires a number greater than or equal to 1.

Using Length Units

svg path {
  stroke-miterlimit: 10px;
}

The miter limit is a unitless ratio, not a length.

Using Percentages

svg path {
  stroke-miterlimit: 50%;
}

Percentages are not valid for this property.

Expecting an Effect With Round Joins

The miter limit does not affect stroke-linejoin: round.

Expecting an Effect With Bevel Joins

The miter limit does not affect stroke-linejoin: bevel.

Confusing Miter Limit With Stroke Width

The miter limit controls a ratio. Use stroke-width to change the thickness of the stroke.

Assuming a Higher Limit Always Changes the Corner

If the existing miter ratio is already below the limit, increasing the limit does not change the appearance.

Forgetting to Define a Stroke

The initial stroke value is none. A miter join is not visible without a painted stroke.

Using a High Limit Near Viewport Edges

Long pointed extensions can be clipped by the SVG viewport. Leave sufficient space around sharp corners.

Assuming miter-clip Has Universal Support

The miter-clip join style has limited browser support. Provide a compatible fallback when using it.

Important Considerations

Keep the following points in mind when using stroke-miterlimit:

  • It limits the length of pointed SVG stroke joins.
  • The initial value is 4.
  • The property is inherited.
  • It accepts a unitless number greater than or equal to 1.
  • Negative values and values below 1 are invalid.
  • Lengths and percentages are not accepted.
  • It works with stroke-linejoin: miter.
  • It also affects miter-clip joins where supported.
  • It does not affect round or bevel joins.
  • Higher limits permit longer pointed corners.
  • Lower limits restrict pointed extensions.
  • A miter join becomes beveled when its ratio exceeds the limit.
  • A miter-clip join clips the extension instead of switching to bevel.
  • Sharper angles produce larger miter ratios.
  • The miter ratio depends on the corner angle.
  • Changing the stroke width does not change the miter ratio.
  • Thicker strokes produce larger visible miter extensions.
  • The property does not modify the underlying SVG path geometry.
  • It has no visible effect on a straight line without corners.
  • A painted stroke is required for the join to be visible.
  • Long extensions may be clipped by SVG viewport boundaries.
  • The property supports numeric interpolation in CSS animations.
  • Test advanced join styles across supported browsers.

Browser Support

The CSS stroke-miterlimit property is widely supported for SVG graphics in modern browsers, including Chrome, Edge, Firefox, and Safari.

Standard miter limit behavior is broadly supported. The SVG 2 miter-clip join style has limited browser support and should be tested separately.

For current compatibility information, visit Can I Use? and search for stroke-miterlimit.

Feature Detection

@supports (stroke-miterlimit: 4) {
  .miter-outline {
    stroke-linejoin: miter;
    stroke-miterlimit: 4;
  }
}

Feature queries can test whether a browser recognizes the property and value syntax.

Fallback Behavior

If a declaration is invalid or unsupported, the browser ignores it. The element uses another applicable value from the cascade or its inherited value, falling back to 4 when no other value applies.

Testing Recommendations

Test sharp angles, thick strokes, low and high miter limits, viewport clipping, and advanced line join styles in the browsers you support.

Specifications

The stroke-miterlimit property is defined in the SVG 2 specification.

SVG 2 - stroke-miterlimit Property

The specification defines the miter ratio and how it limits pointed joins created by stroke-linejoin.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: stroke-miterlimit