Map from Google - Edinburgh

The climate of Edinburgh is cool and moist, cloudy and rainy, being influenced by the ocean. Winter is cold but not freezing, while summer is cool. The average temperature of January is 4 °C (39 °F), that of July and August is 15 °C (59 °F).
Here are the average temperatures.
Average temperatures - Edinburgh
EdinburghJanFebMarAprMayJunJulAugSepOctNovDec
EdinburghJFMAMJJASOND
Min (°C)113471011119641
Max (°C)781012151719191713107
Min (°F)343437394550525248433934
Max (°F)454650545963666663555045

Rainfall is frequent, but not abundant, given that it amounts to about 700 millimetres (27.5 inches) per year, due to the location of the city on the eastern side of Scotland (in fact, a part of the rains fall on the western side). The wind blows frequently, though less than in northern Scotland, and can be stormy, especially in autumn and winter.
Here is the average precipitation.
Average precipitation - Edinburgh
EdinburghJanFebMarAprMayJunJulAugSepOctNovDecYear
EdinburghJFMAMJJASONDY
Prec. (mm)654550405060656065756060695
Prec. (in)2,61,821,622,42,62,42,632,42,427,4
Days1291091010101010121111124

Winter, from December to February, is cold, cloudy, windy and rainy. The average temperature is above freezing (0 °C or 32 °F) even at night, but it's better not to rely too much on the mild winter: lying at a high altitude, Edinburgh as the rest of Scotland is subject to cold waves of polar origin, although they typically do not last long, because after a few days the mild western currents begin to blow again; however, some very cold periods can occur. Furthermore, the wind may increase the feeling of cold, even when the temperature is not too low.
Snowfalls are not abundant, but they are quite frequent, at least on cold winters or on cold periods. Sleet or snow showers can be observed in many occasions, even if the snow does not accumulate on the ground. During the night, light frosts occur quite often, but sometimes, after cold waves, there may be more intense frosts: for example, the temperature reached -17 °C (1 °F) in February 1978 and January 1979, -15 °C (5 °F) in December 1981, -18 °C (0 °F) in January 1982, -12 °C (10 °F) in December 2009, -11 °C (12 °F) in January 2010, and -16 °C (3 °F) in December 2010. Therefore, Edinburgh is exposed to cold waves, and is often the coldest city in the UK.
During mild periods, however, the temperature can reach 10/12 °C (50/54 °F) even in winter, and in the months in which the westerlies prevail, the temperature rarely drops below freezing.

Spring, from March to May, is cold or very cool: night temperatures can drop to a few degrees below freezing in April, and around freezing in May; typically the temperature becomes milder in the second half of May. Rain and wind are not absent in this season (it rains for about 10 days a month), although in May the wind becomes a little less frequent and the sun shines a bit more often. In addition, the days become longer: already in April the sun sets after eight p.m., and from the second week of May to around the 10th of July, the "white nights" occur, that is, it never becomes completely dark.

Summer, from June to August, is cool, or at most mild: maximum temperatures in July and August are on average about 19 °C (66 °F). Atlantic depressions occur also in this season, and there is no shortage of rain. Hot days almost never occur: days with more than 25 °C (77 °F) are a rarity, and the highest records are about 27/28 °C (81/82 °F), not counting the 31 °C (88 °F) recorded exceptionally in August 1975. At night it can be very cool, or cold: even in midsummer at night the temperature can drop to 7/8 °C (45/46 °F), or even below. In return, the days are very long, and you can take advantage of several hours of light, especially in June and in the first half of July.

Autumn, from September to November, is cloudy, rainy and windy. The sun rarely appears, and it does so less and less over the weeks. The days shorten rapidly: in mid-September the sun sets at about 7:30 p.m., in mid-October at about 6 and a quarter, and in mid-November at about 4:00.

The amount of sunshine in Edinburgh is very scarce in autumn and winter, when the sun is rarely seen; in spring and summer, sunshine is relatively more frequent: from May to August sometimes the sun can peep through the clouds.

Edinburgh

The sea is cold all year round: in winter, given the latitude, it's relatively mild, since it reaches a minimum of 7 °C (45 °F) in February and March, while in summer it doesn't go above 14 °C (57 °F) from July to September.
Here are the average sea temperatures.
Sea temperature - Edinburgh
EdinburghJanFebMarAprMayJunJulAugSepOctNovDec
EdinburghJFMAMJJASOND
Sea (°C)87781012141414131210
Sea (°F)464545465054575757555450

When to go

The best time to visit Edinburgh goes from mid-May to mid-September. Those who are sensitive to cold may prefer July and August, being the warmest months; in any case, it's better to bring some heavier clothes, like a jacket, a sweatshirt or sweater, as well as a raincoat or an umbrella.