Ridesharing is an emerging travel mode that reduces the total amount of traffic on the road by combining people’s travels together. While present ridesharing algorithms are tripbased, this paper aims to achieve signicantly higher matching chances by a novel, activity-based algorithm. The algorithm expands the potential destination choice set by considering alternative destinations that are within given space-time budgets and would provide a similar activity function as the originals. In order to address the increased combinatorial complexity of trip chains, the paper introduces an efficient space-time filter on the foundations of time geography to search for accessible resources. Globally optimal matching is achieved by binary linear programming. The ridesharing algorithm is tested with a series of realistic scenarios of different population sizes. The encouraging results demonstrate that the matching rate by activity-based ridesharing is signicantly increased from the baseline scenario of traditional trip-based ridesharing.