For the White House, according to Wikitravel:
President Jefferson opened the White House to the public, and it has
remained so during peacetime (with varying restrictions) ever since.
Following the attacks of September 11th, tours have been available
only for groups of ten or more, and these must be requested up to six
months in advance through your congressman if you're a US citizen, or
through your country's embassy in Washington D.C. if you're a
foreigner.
From the White House website:
Public tours of the White House are available. Requests must be
submitted through one's Member of Congress. These self-guided tours
are available from 7:30 a.m. to 11:00 a.m. Tuesday through Thursday,
7:30 a.m. to 12:00 p.m. Fridays, and 7:30 a.m. to 1:00 p.m. Saturdays
(excluding federal holidays or unless otherwise noted). Tour hours
will be extended when possible based on the official White House
schedule. Tours are scheduled on a first come, first served basis.
Requests can be submitted up to six months in advance and no less than
21 days in advance. You are encouraged to submit your request as early
as possible as a limited number of spaces are available. All White
House tours are free of charge. (Please note that White House tours
may be subject to last minute cancellation.)
If you wish to visit the White House and are a citizen of a foreign
country, please contact your embassy in Washington, DC for assistance
in submitting a tour request.
The US Capitol building depends on whether you want a self-guided tour, organised, and what you want to see. For information on tours available, and the online booking system, there's a handy website. Tours are free, but need to be booked in advance (usually) as they can fill up fast, depending on the time of year and occasion.