Object Sorter
Script for Adobe Illustrator
✦ Available exclusively on Patreon for Pro supporters.
ㅤ
Description
Object Sorter changes the stacking order of selected Illustrator artwork without changing its position on the artboard. Choose a spatial, distance, name, reverse, or seeded shuffle method, preview the result, and apply the order when it looks right.
ㅤ
Features
Object Sorter combines flexible sorting with safeguards that keep complex documents intact.
- Flexible reordering – Sort selected artwork in ten spatial, distance, name, reverse, and seeded shuffle arrangements.
- Selection-safe results – Sort each immediate parent separately while preserving the stacking slots of unselected sibling objects.
- Transactional processing – Preview changes safely and restore the original order if you cancel or if any sorting operation fails.
- Spatial clustering – Adjust how generously objects are grouped into rows or columns with a precise tolerance setting.
- Repeatable randomization – Reuse a seed to reproduce a shuffle or generate a new seed for another arrangement.
- Natural name ordering – Sort names without case sensitivity and keep numeric sequences intuitive, such as Item 2 before Item 10.
-
Artwork-aware geometry – Use visible bounds, clipping paths, and group contents to calculate reliable object centers.
ㅤ
Installation
1. Download the Object Sorter.jsx script file.
2. Place the script in your Adobe Illustrator Scripts folder:
⮑ Mac: /Applications/Adobe Illustrator (Version)/Presets/(Language)/Scripts
⮑ Windows: C:\Program Files\Adobe\Adobe Illustrator (Version)\Presets(Language)\Scripts
3. Restart Adobe Illustrator if it's already running
4. Access the script via File > Scripts > Object Sorter
5. Alternatively, run it directly via File > Scripts > Other Script... and browse to the file location
Tip: You can also drag and drop the .jsx file directly onto the Illustrator workspace to run the script instantly – no installation needed.
ㅤ
Using the Script
ㅤ
Launch the Script
Open a document, select the artwork to reorder, and start Object Sorter from Illustrator's Scripts menu. The script changes stacking order only, so objects stay in place.
- Open a document – Open the Illustrator file that contains the artwork you want to reorder.
- Select artwork – Select at least two objects that share an immediate parent; selections from several layers or groups are processed as separate batches.
- Run Object Sorter – Choose File > Scripts > Object Sorter, or use File > Scripts > Other Script... to browse to the file.
- Review the first-run tour – The quick tour opens automatically the first time this release runs and can be closed or completed before sorting.
If a document, selection, or sortable batch is missing, the script shows a warning and leaves the document and current tool unchanged.
ㅤ
ㅤ

ㅤ
ㅤ
➊ Choose the New Stacking Order
Choose the direction or rule that should determine the selected objects' new front-to-back order. Each parent is sorted independently, and a batch containing only one selected object is skipped.
- Rows: Top-Left → Bottom-Right – Read objects across each row from left to right, beginning with the highest row.

ㅤ
- Columns: Top-Left → Bottom-Right – Read objects down each column from top to bottom, beginning with the leftmost column.

ㅤ
- Bottom → Top · Right → Left – Read objects across each row from right to left, beginning with the lowest row.
- Right → Left · Bottom → Top – Read objects up each column from bottom to top, beginning with the rightmost column.
Choose one of these additional methods when rows or columns are not the best description of the arrangement.
- Distance: Center → Edge – Order objects from nearest to farthest from the average center of the selected batch, keeping the original stack order when distances match.
- Distance: Edge → Center – Order objects from farthest to nearest to the average center of the selected batch, keeping the original stack order when distances match.

ㅤ
- Alphabetical: A → Z – Sort names in ascending natural order without case sensitivity, with unnamed objects given a temporary fallback name.

ㅤ
- Alphabetical Z → A – Sort names in descending natural order without case sensitivity, with unnamed objects given a temporary fallback name.
- Reverse Selected Stack – Reverse only the selected objects within their existing stacking slots.

ㅤ
- Seeded Shuffle – Create a repeatable shuffled order from the current seed; this is the default stacking order on first use.

ㅤ
ㅤ
➋ Refine the Chosen Method
Use the Settings area to control how row and column groups are detected or how a shuffle is generated. Controls that do not apply to the chosen stacking order are grayed out.
- Tolerance – Set a value from 0 to 200 points for the four row and column methods; the sensible default is 10 points.
- Seed – Enter any text to define a repeatable Seeded Shuffle; the default is 1, and an empty field is treated as 0.
ㅤ
These additional controls make precise adjustments faster.
- Decrease tolerance – Click the minus button to subtract 1 point, or Shift-click it to subtract 10 points.
- Increase tolerance – Click the plus button to add 1 point, or Shift-click it to add 10 points.
- Drag / Shift-drag / Option-drag / Alt-drag – Drag the tolerance value horizontally for normal adjustment, hold Shift for ten-times adjustment, or hold Option or Alt for fine 0.1-point adjustment.
- Double-click – Double-click the tolerance value to reset it to 10 points.
- New Seed – Generate a different seed for Seeded Shuffle without typing one yourself.
Leave Tolerance at 10 unless objects that should share a row or column are being separated or combined incorrectly.
ㅤ
ㅤ
➌ Preview and Inspect the Result
Turn on preview when you want to compare stacking orders before committing them. Preview changes only the selected objects' stack positions and can always be restored.
- Preview OFF / Preview ON – Toggle live sorting in the document; preview is off by default, and turning it off restores the original order.
ㅤ
Use the view controls when overlapping objects make the result difficult to inspect.
- Edges visible / Edges hidden – Show or hide Illustrator's selection edges without losing the stored selection; edges are visible by default.
- Zoom to fit selection – Fit the current selection in the active view without changing its stacking order.
ㅤ
ㅤ
➍ Apply or Cancel the Sort
Commit the arrangement when it is correct, or leave the document exactly as it was before opening the dialog. Any failure during processing restores the complete original stack and removes the temporary sorting group.
- Apply – Commit the selected stacking order, save the current mode, tolerance, seed, and dialog position, and show a confirmation with the processed result.
- Cancel – Restore any previewed order and selection-edge state, close the dialog, and discard unsaved setting changes.
ㅤ
These keyboard shortcuts work when the Seed text field is not active.
- Enter / Return – Apply the current settings.
- Escape – Cancel the operation and close the dialog.
ㅤㅤ
ㅤㅤ
☻ Summary
You can now reorder selected artwork by position, distance, name, current stack, or a repeatable shuffle while leaving object coordinates and unselected stacking slots intact. Preview the result, refine the relevant settings, and apply with confidence because cancellation and processing failures restore the original order.
ㅤ
ㅤ