Rapid sky localization of gravitational wave sources is crucial to enable prompt electromagnetic follow-ups. In this article, we present a novel semianalytical approach for sky localization of gravitational waves from compact binary coalescences. We use the Bayesian framework with an analytical approximation to the prior distributions for a given astrophysical model. We derive a semianalytical solution to the posterior distribution of source directions. This method only requires onefold numerical integral that marginalizes over the merger time, compared to the fivefold numerical integration otherwise needed in the Bayesian localization method. The performance of the method is demonstrated using a set of binary neutron stars (BNS) injections on Gaussian noise using LIGO-Virgo's design and O2 sensitivity. We find the median of 90% confidence area in O2 sensitivity to be O(102) deg2, comparable to that of the existing LIGO-Virgo online localization method Bayestar and parameter estimation toolkit lalinference. In the end, we apply this method to localize the BNS event GW170817 and find the 50% (90%) confidence region of 11 deg2 (50 deg2). The detected optical counterpart of GW170817 resides within our 50% confidence area.