Here's one traveler's personal experiences and opinions. My visits were all in February, except once in Barcelona in March.
Madrid is wonderful if you love European painting. You'll want 2 full days for the art museums. I've spent the better part of a day at the Prado twice on separate visits to Spain. I also went to the Thiessen on both trips. It's my favorite, because it has a good collection of Impressionists and on both visits, there were excellent temporary exhibitions as well. I haven't been to the Reina Sofia, modern art doesn't speak to me. I also very much enjoyed the Naval Museum (mostly the Golden Age of Exploration). The palace is definitely one of the best in Europe, if you like extravagant palaces (I do). Other than that, I can't find much to recommend the city. For me it's the least interesting European capital.
I loved Toledo. I spent 2 nights and the better part of 2 days and saw everything on my list. There's lots of beauty and history . . . and hills, San Francisco style.
Barcelona is one of my 3-4 favorite cities in the world. There's so much to see and do. Wonderful art museums, churches, architecture, and musical performances. The food is great, the vibe is good, and there are interesting neighborhoods to explore. And there are day trips if you have the time. In total, I've spent over 2 weeks in Barcelona and hope to go back before the end of 2026. The only sight I visited twice was the MNAC because I only budgeted 3 hours for my first visit and missed so much.