golf--why 18 holes?

I mean, 18 is a fine number with me. Play nine holes, have lunch and a beer, play nine more holes. But who came up with this rather random-seeming number? Why not 20 holes? Or 10, or 15? At least those are “round” numbers? Did it have something to do with the amount of available space at the original golf courses, or is there some cosmic sense to it?

according to this , prior to 1764 Golf courses had however many holes they wished. But St. Andrews in Scotland adopted the 18 holes at that point. Gradually, all other courses went along, although it took 100 more years or so.

samclem is correct. St. Andrew’s decided to go for 18 holes and eventually everybody else decided to do it. The first few British Opens were played on a 15-hole course I believe.
The Royal & Ancient of St. Andrews (not the correct full name) is one of golf’s two ruling bodies, along with the USGA.

Available space I believe also determined the width of an American football field. I believe 160 feet fit nicely inside Yale’s stadium at the time in the 19th Century.

It most certainly was not available space at St. Andrews that caused them to go with 18 holes. When the course had 22 holes, the four extra went up the hill behind the R&A, or so I’ve heard several times. More to the point, the space available holds at least 99 holes of golf–the Old Course is not hard by the water, and the New and Jubilee courses were added to the links land late in the 19th century. The Eden was put in in the early 20th century by H.S. Colt (and desecrated in 1990 with the removal of the first and last two holes–neither here nor there, I suppose), the nine-hole Balgove course was put in somewhere along the way, and the 18-hole Strathtyrum was added in the last few years.

The point being that there was loads of available space in St. Andrews, particularly towards the water.