Although written documents first mention Venice's Carnival at the end of the 11th century, historians point to the year 1162 as the official beginning of the event, which celebrated the victory over and subsequent public humiliation of the Patriarch of Aquileia, and was so much fun that it became an annual event. Masks first began appearing a century later, and as the power of the Venetian Republic grew, so too did the festivities - reaching the point where masked were worn for up to half the year by the end of the 18th century!
Of course all good things come to an end, and when the historically stodgy Austrians took control of the city in 1798, masks were forbidden in public and the tradition all but died out, until it was revived in 1979 as a way to spur tourism and economic growth. The plan worked perhaps too well, as nowadays it's estimated that some three million visitors crowd into Venice during the two-week long festival each year, almost literally packing every square metre of pavement of the city's historic centre. If you'd like to be part of the fantastic chaos, the full programme of event and lots of other info can be found well in advance on the official website.