Around 2 1/2 to 3 hours by road.
The driving distance from Cairnryan to Edinburgh, UK is 126 miles / 202 km.
130 miles
The distance between the two is around 130 miles and a total of 4 hours journey by road.
About 7 hours
8 hours and 6 minutes
Takes around 7 and a half hours driving time
About 4 hours.
Cairnryan was created in 1701.
Cairnryan's population is 142.
Google maps says 4h 30mins. That's probably optimistic.
curry
There is nothing to do in Cairnryan to be honest. It is little more than a small village. If you were staying there for any time it is better to travel to nearby Stranraer which is a bigger town. Also there is a direct bus to Edinburgh from Cairnryan ferry terminal 3 times a day at 10:15, 14:15 and 18:15 (not sure about weekends) failing that, you would need to travel via Glasgow.