Peridynamics (PD) is a meshless approach that addresses some of the difficulties and limitations associated with mesh-based topology optimization (TO) methods. This study investigates topology optimization of structures with and without embedded cracks using peridynamics (PD-TO). To this end, PD is coupled with two different continuous density-based topology optimization methods, namely the optimality criteria and the proportional optimization. The optimization results are compared for a continuous definition of the design variables, which are the relative densities defined for PD particles. The checkerboard issue has been removed using filtering schemes. The accuracy of the proposed PD-TO approach is validated by solving benchmark problems and comparing the optimal topologies with those obtained using a FEM-based topology optimization. Various problems are solved with and without defects (cracks) under different loading and constraint boundary conditions. Topology optimization for an unstructured discretization problem has also been investigated applied to a complex geometry. The optimal topology of a cracked structure may change for different optimization methods. The numerical results demonstrate the accuracy, high efficiency, and robustness of the PD-TO approach.