Station-free bike sharing systems (BSSs) are a new type of public bike system that has been widely deployed in China since 2017. However, rapid growth has vastly outpaced the immediate demand and overwhelmed many cities around the world. This paper proposes a heuristic bike optimization algorithm (HBOA) to determine the optimal supply and distribution of bikes considering the effect of bicycle cycling. In this approach, the different bike trips with separate bikes can be connected in space and time and converted into a continuous trip chain for a single bike. To improve this cycling efficiency, it is important to properly design the bicycle distribution. Taking Shenzhen as an example, we implement the algorithm with OD matrix data from Mobike and Ofo, the two large bike sharing companies which account for 80% of the shared bike market in Shenzhen, over two days. The HBOA results are as follows. 1) Only one-fifth of the bike supply is needed to meet the current usage demand if the bikes are used efficiently, which means a large number of shared bikes in Shenzhen remain in an idle state for long periods. 2) Although the cycling demand is high in many areas, it does not mean that large numbers of bikes are needed because the continuous inflow caused by the cycling effect of bikes will meet most of the demand by itself. 3) The areas with the highest demands for optimal bikes are residential, followed by industrial, public transportation, official and commercial areas, on both working and non-working days. This algorithm can be an objective basis for city related departments to manage station-free BSSs and be applied to design the layout of bikes in small-scale spatial units to help station-free BSSs operate efficiently and minimize the need to relocate the bikes without reducing the level of user satisfaction.