List Item Pairer

Pairs up consecutive items within a single list, item 1 with item 2, item 3 with item 4, and so on, joining each pair with a configurable glue string. If the list has an odd number of items, the final item is left unpaired. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Some data naturally comes in pairs, key/value rows, coordinate pairs, question/answer sets, but arrives as a flat one-item-per-line list that needs to be regrouped.

This tool walks through a list two items at a time and joins each pair with a glue string you choose, so the flat list becomes a list of paired entries.

What Is List Item Pairer?

A list transformer that combines consecutive items, the 1st with the 2nd, the 3rd with the 4th, and so on, into single output entries.

It supports newline, comma, or custom-delimited input, and a fully configurable glue string placed between each pair's two items.

How List Item Pairer Works

The list is split into items using the resolved separator, then walked two at a time: for each pair, the two items are joined with the glue string into a single output entry.

If an odd number of items remains at the end, the final item becomes its own output entry, unpaired.

When To Use List Item Pairer

Use it when you have flat data that logically comes in twos, like alternating labels and values, and need it combined into single entries.

It's also useful for quickly building key-value style strings from two interleaved columns of data.

Often used alongside List Item Grouper, List Merger and List Reverser.

Features

Advantages

  • Clear, predictable pairing order, always item 1 with item 2, item 3 with item 4.
  • Fully configurable glue string between paired items.
  • Odd trailing items are preserved rather than silently dropped.

Limitations

  • Only pairs items two at a time; use List Item Grouper for larger chunk sizes.
  • Does not reorder or filter items first, pairing is strictly based on original list position.
  • The odd trailing item's unpaired status must be handled downstream if your format expects strict pairs.

Examples

Pairing four items with an arrow glue

Input

key1
value1
key2
value2 (glue: " -> ")

Output

key1 -> value1
key2 -> value2

Items 1+2 and 3+4 are joined with the glue string into two output entries.

An odd-length list leaves the last item alone

Input

a
b
c (glue: "-")

Output

a-b
c

With three items, the first two are paired and the third is passed through unpaired.

Best Practices & Notes

Best Practices

  • Make sure your list has items in the exact order you want paired, since pairing is purely positional.
  • Use a glue string that won't be confused with your output separator, to keep the result easy to parse later.
  • Check for a trailing unpaired item if your downstream format strictly requires complete pairs.

Developer Notes

Implemented with a `for` loop stepping by 2 over the split item array; each iteration checks whether a second item exists via an index bounds check before joining with the glue string, otherwise it pushes the lone remaining item unchanged.

List Item Pairer Use Cases

  • Combining alternating label/value lines into single key-value entries
  • Pairing up coordinate components (x, y) exported as a flat list
  • Building simple two-column style rows from a flat list for further processing

Common Mistakes

  • Assuming the tool groups items by matching content rather than by position; pairing is purely based on order.
  • Forgetting that an odd-length list leaves a final unpaired entry in the output.
  • Using a glue string identical to the list's separator, which can make the paired output ambiguous to re-split later.

Tips

  • Sort or reorder your list first with List Sorter or List Reverser if the pairing order matters.
  • Use List Item Grouper instead if you need groups larger than two items.

References

Frequently Asked Questions