4. When a die is rolled three times, the probability that the three numbers facing up can form the side lengths of a triangle whose perimeter is divisible by 3 is $\qquad$ .


4. $\frac{11}{72}$.

Let the numbers obtained by rolling these three dice be $a$, $b$, and $c$ ($a \leqslant b \leqslant c$).

Then the three numbers on the top faces can form the sides of a triangle whose perimeter is divisible by 3 if and only if
$$
a+b>c \text { and } 3 \text { divides } (a+b+c) \text {. }
$$

If they form an equilateral triangle, there are 6 cases.
If they form an isosceles but not equilateral triangle, it is easy to prove that
$$
\begin{array}{l}
a \equiv b \equiv c(\bmod 3) . \\
\text { Hence, }(a, b, c)=(1,4,4),(2,5,5),(3,6,6),
\end{array}
$$

In this case, there are 9 cases.
If they form a non-isosceles arbitrary triangle, then $ac-b \geqslant 1$, so $4 \leqslant c \leqslant 6$, thus,
$$
(a, b, c)=(2,3,4),(3,4,5),(4,5,6) \text {, }
$$

In this case, there are 18 cases.
Therefore, the required probability is $\frac{6+9+18}{6^{3}}=\frac{11}{72}$.