By constructing suitable Borcherds forms on Shimura curves and using Schofers formula for norms of values of Borcherds forms at CM-points, we determine all the equations of hyperelliptic Shimura curves $X_0^D(N)$. As a byproduct, we also address the problem of whether a modular form on Shimura curves $X_0^D(N)/W_{D,N}$ with a divisor supported on CM-divisors can be realized as a Borcherds form, where $X_0^D(N)/W_{D,N}$ denotes the quotient of $X_0^D(N)$ by all the Atkin-Lehner involutions. The construction of Borcherds forms is done by solving certain integer programming problems.