Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Base64#urlsafe_decode64

urlsafe_decode64(str)

Returns the Base64-decoded version of str. This method complies with “Base 64 Encoding with URL and Filename Safe Alphabet” in RFC 4648. The alphabet uses ‘-’ instead of ‘+’ and ‘_’ instead of ‘/’.

The padding character is optional. This method accepts both correctly-padded and unpadded input. Note that it still rejects incorrectly-padded input.