A magma is just a set [Formula: see text] with a single binary operation [Formula: see text] We introduce the class of extended magmas and show that any extended magma [Formula: see text] decomposes as the orthogonal disjoint union of well-described ideals. If [Formula: see text] is of division, it is shown that the above decomposition is by means of the family of its simple ideals. The obtained results are applied to the structure theory of arbitrarily graded arbitrary algebras and to the structure theory of arbitrary superalgebras admitting a multiplicative basis. We state a second Wedderburn type theorem for the class of arbitrary algebras with an arbitrary weak-division grading and for the class of arbitrary superalgebras admitting a division multiplicative basis.