list.zip() belongs to the built-in sass:list module. It pairs items from parallel lists into sublists. This page covers shortest-list length, comma vs space separators, looping with @each, Dart Sass support, and five compiled examples.
01
Concept
Pair parallel lists
02
Module
@use "sass:list"
03
Length
Shortest wins
04
Separators
Comma outer / space inner
05
Pair with
@each + nth
06
Practice
5 examples
Concept
What Is list.zip()?
Imagine two columns of sticky notes: sizes on the left, names on the right. Zipping them stacks each row into a small pair—10px short, 50px mid, and so on. That is what list.zip does at compile time.
list.zip(10px 50px 100px, short mid long) → 10px short, 50px mid, 100px long
Call list.zip($list1, $list2, …) after @use "sass:list".
Source
2
Pair by position
Dart Sass builds one sublist per index until the shortest list ends.
Compile
3
Return structured pairs
You get a comma list of space sublists for @each or nth.
Result
4
✓
CSS sees your utilities
No zip call remains—only the finished classes or properties you emitted.
Watch Out
⚠️ Common Pitfalls
Silent truncation — longer lists lose trailing items without an error.
Expecting input separators — output is always comma outer / space inner.
Confusing with join — join flattens; zip builds pairs.
Forgetting @use — list.zip needs sass:list.
Misreading sublists — use list.nth($pair, 1) / 2 inside @each.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:list" and list.zip() in new SCSS
Keep parallel lists the same length when every item matters
Loop with @each $pair in list.zip(...)
Read pair slots with list.nth
Prefer Dart Sass for built-in modules
❌ Don’t
Expect the browser to evaluate list.zip
Assume unequal lists will error
Use zip when you meant list.join
Rely on LibSass for @use "sass:list"
Forget that inner pairs are space-separated
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about list.zip()
Pair by position—shortest wins; comma list of space pairs.
5
Core concepts
📝01
Call
list.zip($lists...)
API
📦02
Module
sass:list
@use
🔢03
Length
shortest input
Rule
❓04
Shape
comma → space pairs
Safe
✓05
Prefer
Dart Sass 1.23+
Tooling
❓ Frequently Asked Questions
list.zip($lists...) combines parallel lists into one list of sublists. Each sublist holds the items at that position across the inputs. Example: list.zip(10px 50px 100px, short mid long) is 10px short, 50px mid, 100px long.
Official docs: the returned list is as long as the shortest list. Extra items on longer lists are ignored.
The returned list is always comma-separated. Each inner sublist is always space-separated—regardless of the input separators.
Yes. Pass as many lists as you need. Each sublist will contain one value from each input at that index.
Yes. Global zip($lists...) still works. New projects should prefer list.zip() after @use "sass:list".
Built-in modules with @use need Dart Sass 1.23+. LibSass and Ruby Sass do not load sass:list the same way—use the global zip() name there if you must.
Did you know?
Maps already behave like lists of key/value pairs in Sass. If your data is naturally a map, prefer sass:map helpers. Use list.zip when you start from separate parallel lists instead.
list.zip() pairs parallel Sass lists into comma-separated rows of space-separated values. Load it through sass:list, remember the shortest-list rule, and drive utilities with @each plus list.nth.