The median time it took a home listed for sale to go into contract was 40 days in April, the fastest since Redfin started tracking this data in 2010.

This is 10 days lower than it was in April 2016 and nine days lower compared with March.

Scarce inventory was the driving factor. The number of homes for sale dropped 13.3% compared with April 2016, the steepest decline in four years, Redfin said.

And the real estate market is likely to get tighter in the next few months.

"The market tends to accelerate through June so I wouldn't be surprised if new records for speed and competition are reached in May and June given what we are seeing now. The only record this market can't break is sales. You need more inventory for that," said Redfin Chief Economist Nela Richardson in a press release.

As recently as February, the national median for days a home was on the market was 60, but in March that fell to 49 days.

Denver was the fastest market, with nearly half of all homes going under contract in just six days, down from 11 days a year earlier. The Pacific Northwest was a hotbed of activity as Seattle was second fastest at seven median days on market, followed by Portland, Ore., and Tacoma, Wash., at 10 days.