Skip to content Skip to footer navigation
🏰 Statamic Summit 2027 Feb 16–19 Talks, workshops, and three nights in a German castle. Get Tickets

URL Encode Modifier

URL-encodes a string. The inverse of urldecode.

string: I just want & need $pecial characters!
{{ string | urlencode }}
{!! Statamic::modify($string)->urlencode() !!}
I+just+want+%26+need+%24pecial+characters%21

If you don't want forward slashes (/) to be encoded, use the urlencode_except_slashes modifier instead.