Strumento gratuito

    Codificatore/Decodificatore URL

    Codifica i caratteri speciali per garantire la sicurezza degli URL oppure decodifica istantaneamente le stringhe con codifica in percentuale.

    Codifica URL

    Che cos’è la codifica URL?

    La codifica degli URL (nota anche come codifica percentuale) sostituisce i caratteri non sicuri o riservati presenti in un URL con il simbolo % seguito da due cifre esadecimali. Ad esempio, uno spazio diventa %20. Ciò garantisce che gli URL vengano trasmessi correttamente su Internet senza ambiguità.

    encodeURIComponent vs. encodeURI

    La funzione `encodeURIComponent` codifica tutti i caratteri tranne quelli alfanumerici e - _ . ! ~ * ' ( ). Utilizzala per i parametri di query. La funzione `encodeURI` conserva i caratteri strutturali degli URL come : / ? # [ ] @, rendendola adatta alla codifica di URL completi.

    Casi d'uso comuni

    • Codifica dei parametri delle stringhe di query contenenti caratteri speciali
    • Preparazione delle stringhe da utilizzare nelle richieste API e nei webhook
    • Debug degli URL con codifica percentuale dai log del server
    • Codifica dei percorsi dei file contenenti spazi o caratteri Unicode
    • Conversione tra formati "URL-safe" e formati leggibili dall'utente

    Monitora le tue API e i tuoi siti web 24 ore su 24, 7 giorni su 7

    Assicurati che i tuoi endpoint siano sempre raggiungibili grazie al monitoraggio dell'uptime e delle API di Xitoring.

    Avvia il monitoraggio gratuito

    URL Encoding FAQ

    Common questions about percent-encoding, spaces and double encoding.

    Should a space be encoded as %20 or +?
    In URL paths, a space is always %20. In query strings sent by HTML forms (application/x-www-form-urlencoded), a space can also appear as +. encodeURIComponent always produces %20, which works everywhere.
    What is double encoding?
    Encoding a string that is already encoded: %20 turns into %2520, because the % sign itself gets encoded. It usually happens when two layers of code both encode the same value. Decode the string once to see whether that's what happened.
    Which characters need to be encoded?
    Inside a URL component, everything except letters, digits and - . _ ~ should be encoded. Reserved characters such as & = ? / # need encoding when they are part of a value. Non-ASCII characters are encoded as their UTF-8 bytes, so é becomes %C3%A9.
    Is my input sent to a server?
    No. Encoding and decoding run in your browser, so what you paste never leaves your device.