Topology optimization is a state-of-the-art tool for detecting the best material layout in a physical space to obtain certain goals. Initially developed as a structural engineering tool, it has been recently used in electromagnetics and has shown immense potential. The aim of this work is to build a framework for applying the topology optimization method in electromagnetics using a modified binary particle swarm optimization (BPSO) algorithm. In this article, a classic problem of coax to waveguide transition has been considered, and a novel solution has been given using topology optimization. The steps to implementing topology optimization using BPSO have been thoroughly documented. The optimized transition has been fabricated and is shown to produce results coinciding with the simulation. Traditional transitions were used in the analysis to compare and validate the optimized structure. The results obtained have been very promising, and this technique can be utilized in creating elegant solutions to complex electromagnetic problems.