The air is clearer than in the days when soot-choked skies gave Edinburgh the nickname Auld Reekie. But even today it remains a gray city. Particularly in dull weather, which is to say most of the time, Edinburgh's buildings exude a dour air, as if centuries of chill winds and cheerless drizzle had been absorbed into their stones, and are only now seeping back into the atmosphere.

But if Edinburgh is forced by its latitude -- it is as far north as Kodiak, Alaska -- to exist in a more or less perpetual November, it does so with appealing grace. For all its dark grimness, it is also unceasingly stately, urbane and fetching.

The ancient capital of Scotland, the "Athens of the North," it is an elegant and cosmopolitan seat of history and learning. To Robert Louis Stevenson, perhaps its most famous native son, it was "this profusion of eccentricities, this dream of masonry and living rock." Thomas Jefferson considered it a town that "no place in the world can pretend to compete with." The Times of London recently dubbed it "the most handsome city in Britain." Very possibly it is.

What is beyond all doubt is that for three weeks each August, when it holds the biggest arts festival in the world, Edinburgh is simply the greatest place on earth.

Edinburgh's dominant feature, both physically and historically, is its vast and majestic castle, perched dramatically on a rocky outcrop above West Princes Street Gardens. At about $3, it doesn't cost much to go inside, but then it doesn't offer much. There's a Great Hall with an imposing hammer-beam ceiling and some suits of armor, plus the Scottish crown jewels, the room in which King James I was born and a large number of glass cases containing tattered kilts and other remnants commemorating the exploits of several Scottish regiments.

But for most visitors, the castle's appeal is entirely external -- as something fabulous to gawk at from below or as a platform from which to gaze out over the hills and sprawl of the city. There is no admission to the grounds, and the views across Edinburgh to the distant Firth of Forth and the hills of Fife are as beautiful as they are alliterative.

The setting is simply magnificent. Almost 270 feet below you is Princes Street, lined on its northern side by department stores and shops and on its southern edge by the lovely twin parks called West Princes Street Gardens and East Princes Street Gardens. Effectively they are one park -- split by a through street called The Mound -- running the length of Princes Street. This street is both the city's main shopping thoroughfare and the boundary between the two halves of Edinburgh: the Old Town, with its cramped and twisted lanes, clustering in the shelter of the castle, and the broad, straight avenues of the New Town to the north.

Just south of Princes Street, the castle anchors the western end of Edinburgh's Royal Mile (actually only eight-tenths of a mile). The Mile, confusingly, consists of five streets -- Castle Hill, Lawnmarket, High Street, Canongate and Abbey Strand -- running through the Old Town, from the castle at the western end to the squat but imposing Palace of Holyroodhouse on the edge of the sprawling, windswept Holyrood Park to the east.

Mary, Queen of Scots, lived at Holyroodhouse for six years and Charles I was crowned king of Britain there. (The Scots wouldn't let the crown out of the country.) It remains a royal palace -- Queen Elizabeth and Prince Philip stay there when they are in town -- but the state apartments are open to visitors the rest of the time. The guided tours are excellent -- brisk, informative and amusing.

The palace was begun in 1498, but most of what you see today dates from the 1670s, when Charles II had it rebuilt and expanded. The tours take you through the grand state apartments, with their heavy furniture and dark paintings. Everything is on a predictably stately scale. The gallery contains portraits of more than 70 Scottish monarchs (including Macbeth), but the most potent presence in the palace is Mary, Queen of Scots. It was here that she met John Knox and here that her trusted secretary David Rizzio was brutally slain at the behest of Lord Darnley, Mary's vain and loutish husband.

You could walk the Royal Mile in minutes. But it is far better to take half a day to poke around in the 100 or so side streets of the Old Town, the little wynds (narrow lanes) and closes (dead-end alleys) -- places like James Court, where James Boswell and the philosopher David Hume lived, or Brodie's Close, once the home of the infamous Deacon William Brodie, a city councilor by day and cat burglar by night. He provided the inspiration for Robert Louis Stevenson's "Dr. Jekyll and Mr. Hyde" and was hanged nearby on a gallows of his own devising.

Everywhere you wander in the Old Town you will bump into some relic of the past -- a house or pub connected with Robert Burns, Adam Smith, Sir Walter Scott, James Boswell, John Knox or even the splendidly named William Smellie, who published the first Encyclopedia Britannica. Much of the Old Town has been heavily gentrified in recent years, and some of the closes (pronounced with a soft "s," by the way, as in "close call") have taken on an almost Disney-like picturesqueness.

But for conservation at its very best, you must cross Princes Street to the elegant squares and well-ordered avenues of the New Town. The area was started in the 18th century by the architect James Craig, then just 23, but it is most indelibly associated with the great Robert Adam, especially Charlotte Square, laid out in 1791 and considered by many his masterpiece.

The New Town is in any case the biggest and most assiduously preserved expanse of Georgian architecture in Britain, and one of the most agreeable places for a stroll to be found anywhere. Particularly worth seeing is the Georgian House at 7 Charlotte Square, where the National Trust for Scotland has diligently recreated the interior of a typical residence as it was in its heyday. The New Town Conservation Centre, at 13a Dundas St., has interesting exhibitions about the restoration work and organizes guided walks of the area.

Princes Street was once famous for its elegant shops. But apart from Jenners, a venerable department store with a galleried main hall and impressive beamed ceiling, the stores today are mostly unexceptional. Now the street is made memorable by the Princes Street Gardens. The focal point of the gardens is the large and endearingly ugly Scott Monument -- which someone once described as a Gothic rocket ship -- built in the memory of Sir Walter Scott. Keep an eye out also for the park's floral clock; constructed in 1904, it was the first of its type in the world.

On Princes Street you also will find the city's newest shopping center, the subterranean Waverley Market. One of the more interesting stores is The Whisky Shop, containing a spectacular assortment of Scotch whiskies in every imaginable type of container. Also located in Waverley Market is the city's main tourist information office, with its helpful accommodation service. And at this time of year you may well need it.

In late summer, Edinburgh gets festivals the ways other places get flies. There is first of all the famous Edinburgh International Festival, which spawned the unofficial but now even larger Fringe Festival. And that in turn has inspired satellite festivals for movies, jazz, books, television and even hot-air balloons.

Among them they offer literally thousand of things to watch. But they also attract hundreds of thousands of people to watch them. Last year almost a quarter of a million people -- equivalent to half the city's normal population -- poured into Edinburgh at festival time.

To its credit, Edinburgh does much to smooth things for the visitor, keeping museums open into the evenings and arranging special exhibitions to thin the crowds. Even many pubs stay open until 3 a.m. (Scotland not only has its own money and legal system, but, even more sensibly, its own pub-licensing laws -- hence the longer opening hours than in England.)

Tickets for the International Festival, Aug. 10-30 this year, are most difficult to come by. More promising is the Festival Fringe, as it's properly known. It runs Aug. 8-30 and offers more than 1,000 shows of all descriptions, both amateur and professional, comprising about 7,000 performances. Some of them are incredibly good, and go on to long and successful runs elsewhere, and some are just awful. They take place in about 150 theaters and church halls, or simply outdoors, most notably around The Mound, where fire-eaters, jugglers, dancing bears and other street performers entertain the throngs. The Fringe's main box office is at 170 High St.

The one event not to be missed is Fringe Sunday, or "a lark in the park," as it is sometimes called. Held in Holyrood Park, it is simply a vast, happy picnic for the whole city at which Fringe artists perform for free. This year it is on Aug. 17.

Preceding all this -- but mercifully not quite overlapping -- are the Commonwealth Games, a sort of mini-Olympics for Britain and her former colonies which began in Edinburgh July 24 and end Saturday. They, too, always attract big crowds.

If all the noise and pulsating merriment give you a sudden longing for tranquility, Edinburgh has about a dozen first-rate museums you can escape to. One of the most memorable and convenient is the National Gallery of Scotland, on The Mound. As national collections go, it is small but unerringly excellent, with paintings by Titian, Raphael, Rembrandt, Van Gogh and Constable. And it's free.

Slightly further afield, but well worth seeking out (and also free), is the Scottish National Gallery of Modern Art, recently moved from the Botanic Gardens to a handsome refurbished 19th-century building on Belford Road. It contains one of the two best collections of 20th-century art in Britain (the Tate Gallery in London being the other), with works by Picasso, Matisse, Hockney and many others. But you could visit it for the splendid building alone.

Much the same could be said of the National Museums of Scotland on Chambers Street, just south of the Royal Mile. Its galleries contain an eclectic assortment of stuffed animals, fossils, archeological relics and much else. But its main hall with its glass roof and burbling fountains is possibly the most agreeable spot for the foot-weary in the whole of Edinburgh.

But beware when you ask directions: the National Museums of Scotland was until recently called the Royal Scottish Museum and is generally still referred to as such, not only by residents but also on maps and tourist pamphlets. To compound the confusion, there is a second National Museums of Scotland, the former National Museum of Antiquities, on Queen Street.

Confronted with such complexities, you begin to understand why it took the English centuries to subdue the Scots. Bill Bryson lives in London, where he works for The Times.