San Francisco is about 5 times smaller than Madrid.

Madrid is approximately 604 sq km, while San Francisco (including the city proper only) is approximately 121 sq km, making San Francisco 20.02% the size of Madrid.
Tip: This to-scale comparison of Madrid vs. San Francisco uses the Mercator projection, which distorts the size of regions near the poles.