Beam splitter (BS) is an important element for photonic integrated circuits (PICs). Conventional BSs designed by traditional approaches are too large to be suitable for PICs. An inverse design method which combines the adjoint method with the finite-difference frequency-domain method (FDFD) and the finite-difference time-domain method (FDTD) is proposed, in which the adjoint method is adopted to construct the structures while the FDFD is used to simulate the fields of the structures at the target wavelength, and the FDTD is used to study their fields and spectra at a wider wavelength range. And a series of compact Si-based arbitrary ratio power splitters (ARPSs) with splitting ratios ranging from 1:1 to 10:1 on 2.5 μm × 2.5 μm substrates have been designed by this method. Their splitting ratios fully match the design expectation accurately with total transmission efficiencies of more than 90% at the target wavelength of 1550 nm. Multi-channels BSs with 3:4:1 and 4:1:3:2 splitting ratios have been designed by this method as well, and have good performance with footprints of 2.5 μm × 2.5 μm and 3.2 μm × 3.2 μm, respectively. Furthermore, the Si3N4-based ARPSs with footprints of 3.0 μm × 4.0 μm have been designed, and their performance met expectations also. The results of 2:1 and 3:1 Si3N4-based ARPSs have been shown that total transmission efficiencies are 88.14% and 91.48% at the center wavelength of 1400 nm. Benefiting from the high speed of FDFD, this method has high optimization efficiency. And all the results simulated by FDTD agree well with FDFD. It provides a robust means to construct compact ARPSs and other nanophotonic devices.