Public transportation in Budapest is excellent by international standards: extensive, reliable and cheap.There are three metro lines (Yellow, Blue and Red); all of them meet at Deák tér and run from 4:30 am to 11:30 pm.
Most bus and tram lines operate until 11 pm, except for certain key lines that run all night (sign: letter “E” is attached to the line number e.g. bus number 182E).
Suburban trains called HÉV can be used to visit the tourist attractions in small towns outside Budapest (Szentendre, Gödöllő).
Fares cannot be paid on board and there are fines for traveling without a validated ticket. Tickets are good for one ride only and a new ticket must be used every time you change lines. Tickets can be purchased at vendors, metro stations, hotels, news-stands and tobacco shops; they can be validated in meters (red punch slots), on board (tram, bus) or at station entrances in case of metro rides (orange boxes).
Instead of single tickets you may consider buying a carnet of 10 / 20 tickets, a pass (for 1/5/7/ 14 days or for a month), or a Budapest card. These are available at metro stations or at end stations of public transport.