The optimization of the exhaust port shape for best mass flow is an excellent opportunity to improve fuel economy, emissions, and knock sensitivity of internal combustion engines (ICE). This is valid for many different types of combustion systems including gasoline, alcohols, alternative fuels such as compressed natural gas (CNG) or hydrogen, and e-fuels. Nowadays, so-called cylinder-head integrated exhaust manifolds (IEM) guide the exhaust gas from the combustion chamber to the turbocharger. This specific design requires lots of strong bends and turnings of the exhaust ports in very narrow space, since they need to be guided through a labyrinth of bolts, water cores, and oil passages. In fact, this challenges the avoidance of increased pressure drops, reduced mass flow rates, and deterioration of port flow efficiencies. The optimization of the individual port by computational fluid dynamics (CFD) is a proper means to minimize or even eliminate these drawbacks. Meanwhile, there are several powerful optimization methods for three-dimensional flows on the market. In this paper, a combined strategy of CFD topology and shape optimization is presented. This method has been applied to several Ford four-valve engine designs with either twin (Siamese) exhaust ports as well as single ports within two separate IEMs. CFD optimizations have been done for various valve lifts resulting in improved mass flow rates by up to 14 % and an improved mass flow balance between the twin exhaust ports. New flow cross-sections such as L-, F-, and T-shapes have been identified. At the end, an initial design of flow-optimized ports has been generated including body-fitted water jacket surfaces. This allows the designer to already start with an optimized exhaust port design. The new workflow is highly efficient, reduces development time, improves result quality, and may reduce the number of expensive prototypes as well as time-consuming test-rig measurements.