An algebraic zip datum is a tuple $\CZ := (G,P,Q,\phi)$ consisting of a
reductive group $G$ together with parabolic subgroups $P$ and $Q$ and an
isogeny $\phi\colon P/R_uP\to Q/R_uQ$. We study the action of the group $E :=
\{(p,q)\in P{\times}Q | \phi(\pi_{P}(p)) =\pi_Q(q)\}$ on $G$ given by
$((p,q),g)\mapsto pgq^{-1}$. We define certain smooth $E$-invariant
subvarieties of $G$, show that they define a stratification of $G$. We
determine their dimensions and their closures and give a description of the
stabilizers of the $E$-action on $G$. We also generalize all results to
non-connected groups. We show that for special choices of $\CZ$ the algebraic
quotient stack $[E \backslash G]$ is isomorphic to $[G \backslash Z]$ or to $[G
\backslash Z']$, where $Z$ is a $G$-variety studied by Lusztig and He in the
theory of character sheaves on spherical compactifications of $G$ and where
$Z'$ has been defined by Moonen and the second author in their classification
of $F$-zips. In these cases the $E$-invariant subvarieties correspond to the
so-called "$G$-stable pieces" of $Z$ defined by Lusztig (resp. the $G$-orbits
of $Z'$).