Sometimes I want to swap two objects, so one of selected will be on second's place, and vice versa. There is any simple way to do it?

  • You can swap Symbols but I'm unaware of any native feature to swap just plain objects.
    – Scott
    Mar 24, 2015 at 6:39

6 Answers 6


In addition to Naty's answer, the "swap objects" script by Wundes also swaps the dimensions of the objects. I made a similar script which just swaps the position regardless of the dimensions.

The script swaps 2 objects based on the objects center x & y.

Here you go:

try { 
    var selObjs = "Please select two objects on the page.";
    var docRef = activeDocument;
    if (documents.length>0) {
        if (docRef.selection.length == 2) {
            mySelection = docRef.selection;

            //if object is a (collection of) object(s) not a text field.
            if (mySelection instanceof Array) {
                //initialize vars
                var object_A = mySelection[0];
                var object_B = mySelection[1];

                // Calculate new center object A
                new_A = [
                // Calculate new center object B
                new_B = [
                // Make the swap
                object_A.position = new_A;
                object_B.position = new_B;

            } else {
                alert(mySelection+" is not an array!\n"+selObjs);
        } else {
            alert("Selection is not 2 objects!\n"+selObjs);
} catch(e){

You can download the "Swap Objects" script and run it or...

  1. Copy and paste in front both of them
  2. Align the first to the second and vice versa.
  3. Delete the old ones
  • already do it everytime when I need to swap them but it's not so fast method Mar 25, 2015 at 7:31
  • found a script for you, it's in my answer
    – Naty
    Mar 25, 2015 at 7:42
  • I have CC 2015 and can't get this to work
    – Jay
    Jul 29, 2016 at 18:47
var centerToOrigin1 = [object_B.getLeft()+(object_B.getWidth()/2)] - [object_A.getWidth()] / 2, [object_B.getTop()+(object_B.getHeight()/2)] - [object_A.getHeight()] / 2;
var centerToOrigin2 = [object_A.getLeft()+(object_A.getWidth()/2)] - [object_B.getWidth()] / 2, [object_A.getTop()+(object_A.getHeight()/2)] - [object_B.getHeight()] / 2

This one works for me.


I'm new to AI coming from Inkscape and I miss this feature. A quick workaround is to select both objects then flip once horizontally then vertically. You then get back to selecting each object individually and repeat the flipping operations. It's several clicks away compared to Inkscape's one button tool but it is what it is...


In Adobe Illustrator when you select two objects like OBJECT A and OBJECT B and now if you want to swap each other just select both object and then again select A or B now it's selection become bold and other object will come to that object.

  • can you explain your answer? I misunderstand this. Mar 25, 2015 at 7:33
  • After selecting two object you need to assign key object. Then other object will align based on key object.
    – user9183
    Mar 25, 2015 at 11:24
  • helpx.adobe.com/illustrator/using/… Refer below topic from above link: => Align or distribute relative to a key object
    – user9183
    Mar 25, 2015 at 11:33
  • It's obvious. I know it. It will place first object into position of second. I need to do this with second object too. Mar 26, 2015 at 9:18
  • Every time you should to assign key object first. Without assign key object you can't move to particular place or it will behave as per you selection or art board which is set in align pallet. One more tool is reflect but that may be not work.
    – user9183
    Mar 27, 2015 at 4:17

I'm assuming you are referring to the order of the objects here. You can use the layer palette for this. Select one object then in the palette drag it to the place you desire.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.