It was in January that Andreas Seppi shocked Federer in the third round of the Australian Open but the Swiss star got his payback Tuesday winning 6-3,6-4 in 82 minutes on centre court.
It was Federer's only loss and it snapped his streak of 11 straight semi-final appearances at the Aussie Open.
"It was good to play him right away again and erase it from the memory," said Federer.
"This was one of those matches where I was happy to get through and happy it was over."
Federer moves through to the round of 16 to play American Jack Sock, who beat Spain's Roberto Bautista-Agut 3-6, 6-3, 6-2.
Three-time Indian Wells champion Nadal avoided a second straight early exit from the tournament with a 6-4, 6-2 victory over Donald Young.
Nadal will square off against France's Gilles Simon for a berth in the quarterfinals.
Last year, Nadal was eliminated in the third round by Alexandr Dolgopolov 7-6, 6-4. It was his earliest exit in the California desert tournament since 2004.
"Last year was 2014 and we are in 2015. Every year is different," Nadal said.
"I played a lot of good tournaments here with good results," he said.
"I feel very comfortable. I happy to be in the fourth round."
World number one Serena Williams woke up after a slow start to battle past American compatriot Sloane Stephens in three sets to reach the quarterfinals.
The 19-time Grand Slam winner defeated a dogged Stephens 6-7 (3/7), 6-2, 6-2 as her emotional return from a 14-year Indian Wells boycott gathers pace.
Williams, 33, said it was good to play a two-hour match because she needs to step up her game if she is going to advance deeper into the draw.
"I still am trying to find my bearings," she said.
"I have been off a little this week.
"I just had to stay focused and use the experience of a three-set match."
Williams, who blasted 14 aces and broke Stephens six times in the two-hour, six-minute match, faces Timea Bacsinszky of Switzerland next.
The two former Fed Cup teammates have a colourful history after Stephens, 21, upset Williams in the quarterfinals of the 2013 Australian Open in three sets.
That win ended Williams' 20-match winning streak and the two haven't been chummy since then.
Sixth seeded Canadian Eugenie Bouchard was upset by qualifier Lesia Tsurenko, who rallied for a 6-7 (5/7), 7-5, 6-4 victory.
In other matches Tuesday, defending champ Flavia Pennetta eliminated second-seeded Maria Sharapova of Russia 3-6, 6-3, 6-2 and third seed Simona Halep, of Romania, defeated Karolina Pliskova 6-4, 6-4.
On the men's side, Canadian sixth seed Milos Raonic hammered Dolgopolov 7-6 (7/2), 6-4, Czech Tomas Berdych rolled over American Steve Johnson 6-4, 6-2 and Simon took care of Michael Berrer, of Germany, 6-2, 7-5.