Quiver 5D N = 1 gauge theories describe the low-energy dynamics on webs of (p, q)-branes in type IIB string theory. S-duality exchanges NS5 and D5 branes, mapping (p, q)-branes to branes of charge (−q, p), and, in this way, induces several dualities between 5D gauge theories. On the other hand, these theories can also be obtained from the compactification of topological strings on a Calabi-Yau manifold, for which the S-duality is realized as a fiber-base duality. Recently, a third point of view has emerged in which 5D gauge theories are engineered using algebraic objects from the Ding-Iohara-Miki (DIM) algebra. Specifically, the instanton partition function is obtained as the vacuum expectation value of an operator T constructed by gluing the algebra's intertwiners (the equivalent of topological vertices) following the rules of the toric diagram/brane web. Intertwiners and Toperators are deeply connected to the co-algebraic structure of the DIM algebra. We show here that S-duality can be realized as the twist of this structure by Miki's automorphism.