CSS Autoprefixer
Paste CSS, choose target browsers with a Browserslist query, and get the -webkit-, -moz- and -ms- prefixes those browsers still need, outdated prefixes removed, tidy or minified output and a list of every change.
Działa w Twojej przeglądarce. Twoje pliki nigdy nie opuszczają urządzenia. Zobacz, jak to sprawdzić
…
Jak to zrobić
- 1Paste or open CSS
Paste your stylesheet, open a .css file or load one of the three samples.
- 2Set the query
Type a Browserslist query or pick a common one and read the resolved browser list.
- 3Choose what to do
Add needed prefixes, remove outdated ones, strip everything first or enable IE modes.
- 4Pick the output
Beautify with two spaces, four spaces or tabs, or minify.
- 5Read the changes
Check each added or removed item and the browsers behind it.
- 6Save
Download or copy the output, export the change list as CSV or print a report.
O tym narzędziu
Vendor prefixes such as -webkit-user-select or -moz-columns were how browsers shipped CSS features before the standard settled. Some are still needed today, mostly by Safari and iOS, and many old ones are dead weight in a modern stylesheet. This autoprefixer works out which ones your audience needs. You describe the audience with a Browserslist query, the same mini-language used by Autoprefixer, Babel and most front-end build tools. The tool supports a practical subset: defaults, last N versions, last N versions of one browser, usage thresholds such as > 0.5%, version comparisons such as safari >= 15, version ranges, Firefox ESR, dead, and the combinators or, and, not and commas. The resolved list of browser versions is shown, so you can see exactly what the query means. A CSS parser then reads your stylesheet into rules, at-rules and declarations, keeping comments, strings and nested blocks intact. A prefix table modelled on Can I Use data covers more than forty features: properties such as user-select, appearance, backdrop-filter, masks, transforms, transitions, animations, flexbox, hyphens and multi-column layout; values such as position: sticky, gradients, image-set() and the stretch sizing keyword; selectors such as ::placeholder, ::selection, :fullscreen and ::file-selector-button; and at-rules such as @keyframes and resolution media queries. Optional modes add the old -ms- flexbox and IE grid syntax when you still target Internet Explorer.
What the change list tells you
Every declaration or rule the tool adds or removes appears in a table with the rule it belongs to and the reason. Added prefixes list the browser versions that need them, grouped as ranges such as Safari 18.6-26.1, and removed ones say that no selected browser needs that prefix any more. A second tab shows the whole prefix table against your targets, which is a quick way to see that -webkit-backdrop-filter is only needed for iOS 17.6 or that Chrome 109 still wants -webkit-mask-image. Because the browser list and usage shares are an editable snapshot rather than live data, you can type the latest versions and paste the usage figures from your own analytics, and the query results follow.
Worked example
The component sample with the defaults query resolves to 24 browser versions in the example snapshot. Five prefixes are added: -webkit-user-select for Safari 18.6-26.1 and iOS Safari 17.6-26.1, -webkit-backdrop-filter for iOS Safari 17.6, -webkit-mask-image for Chrome 109, -webkit-background-clip: text for Chrome 109 and iOS Safari 17.6, and -webkit-image-set() for Chrome 109. Nothing is removed. The beautified file grows from 469 to 721 characters, and the minified version is 619 characters. The legacy sample with the query last 2 versions, not dead resolves to 16 versions and goes the other way: eight outdated prefixes are removed, including -webkit-box-sizing, -moz-transition, -webkit-border-radius, display: -webkit-flex and the whole @-webkit-keyframes block, and the file shrinks from 499 to 207 characters.
Limits
The browser versions, usage shares and some end versions in the prefix table are an example snapshot labelled as such, not live Can I Use data, so check critical features for your exact targets. The query subset does not include cover, since, supports or Node versions. The IE grid translation handles explicit lines and spans, not named areas.
Przykład z rozwiązaniem
defaults query, 24 versions: 5 prefixes added, 0 removed; legacy sample: 8 outdated prefixes removed.
W skrócie
- Kategoria: Programowanie i dane
- Działa w przeglądarce, bez rejestracji i wysyłania.
- Wpisane informacje zostają na Twoim urządzeniu.
- Dostępne po angielsku.
- Treść ostatnio sprawdzona:
- Oficjalne źródło: Can I Use browser support tables
Najczęstsze pytania
Which Browserslist queries work here?
defaults, last 2 versions, last 2 safari versions, > 1%, >= 0.5%, safari >= 15, chrome 100-110, ie 11, Firefox ESR, dead and not dead, combined with commas, or, and, and not. Unsupported terms are named in a warning instead of being ignored.
Why does it add -webkit-user-select for current Safari?
Safari on macOS and iOS still needs the prefixed property for user-select in the example data. If your audience has none of those browsers, the prefix is not added.
Will removing prefixes break old browsers?
Only prefixes that no browser in your query needs are removed. If you widen the query, for example by adding ie 11 or safari >= 9, the needed prefixes are kept or added again.
What does strip every prefix first do?
It deletes all vendor-prefixed declarations, values, selectors and at-rules before prefixing. Use it to clean up a stylesheet that was prefixed by hand over the years, then let the tool add back only what the query needs.
Does it support IE 11 grid?
Tick IE 10-11 grid and target ie 11. Display grid, template columns and rows (with repeat converted to the old syntax) and grid-row and grid-column lines and spans are translated; named areas and gaps are flagged because IE has no equivalent.
Can I use it on Sass or nested CSS?
The parser accepts nested rules and at-rules, so plain nesting is prefixed correctly. Sass variables, mixins and functions are kept as text, so compile Sass first for exact results.
