list.zip($lists...) combines every list in $lists into a single list of sublists. Each sublist holds the items at that position across the inputs. Load it with @use "sass:list" on Dart Sass 1.23+ (global zip() still works).
Official samples.
list.zip(10px 50px 100px, short mid long) → 10px short, 50px mid, 100px long. Shorter second list: list.zip(10px 50px 100px, short mid) → 10px short, 50px mid.
Separators are fixed.
The outer list is always comma-separated. Each inner sublist is always space-separated—regardless of the input separators.
Shortest list wins.
The result is as long as the shortest input. Extra items on longer lists are dropped—align lengths when every pair matters.
Syntax
Syntax
SCSS
@use "sass:list";
list.zip(10px 50px 100px, short mid long);
// 10px short, 50px mid, 100px long
list.zip(10px 50px 100px, short mid);
// 10px short, 50px mid
list.zip(1 2 3, a b c, x y z);
// 1 a x, 2 b y, 3 c z
Pattern: build parallel token lists → list.zip → loop with @each or read pairs with list.nth.
Reference
How Zip Pairs
Keep these rules in mind when shaping token lists:
Rule
Detail
Position pairing
Index 1 of each list → first sublist; index 2 → second; …
Result length
Equal to the shortest input list
Outer separator
Always comma
Inner separator
Always space
Arity
Variadic—two, three, or more lists
Empty input
Zipping an empty list yields an empty result
Maps count as lists.
Every map is a list of key/value pairs, so list helpers—including zip—also apply to maps when that shape fits your data.
Shortest list sets the length — extras are dropped.
Comma outside, space inside every time.
Great with @each for utility and token loops.
One line: when parallel token lists need pairing, call list.zip($a, $b, …).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:list"
2. Keep parallel lists the same length when every pair matters
3. Remember: outer comma, inner space
4. Loop with @each $a, $b in list.zip(...)
5. Confirm length/separator with list.length / list.separator
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 dropped.
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 contains one value from each input at that index.
Because each sublist is space-separated, you can destructure: @each $size, $name in list.zip($sizes, $names) { ... }.
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.