Tom Hartland
  • Blog
  • Photos

URI encoding in Javascript

Difference between encodeURI and encodeURIComponent

I can never remember the difference between encodeURI and encodeURIComponent when encoding data for inclusion on URI/URLs.

For general use, encodeURIComponent is what I need, as it also encodes the following characters: ; / ? : @ & = + $ , #

Added 10/02/2023 10:18
  • 2024
    • October
      • Align SQL Login to User
    • May
      • SQL XML Ordering
  • 2023
    • December
      • Chrome Self-Signed SSL HSTS
    • May
      • String Template Format
    • February
      • Convert List<object> to List<int>
      • URI encoding in Javascript
      • Merging jQuery objects
  • 2022
    • May
      • Listing XML nodes in XSLT
      • XML node value in TSQL
      • Class-less JSON (Newtonsoft)
  • 2021
    • April
      • Variables in TSQL XML
  • 2020
    • March
      • Override Default Mobile Font Size
    • January
      • DNS Info Via Command Line
  • 2019
    • May
      • Restore USB Stick Full Capacity
    • April
      • Removing Entire Unix Directory
    • January
      • Handling 404 Errors in Development
  • 2018
    • November
      • Generating Row Numbers in SQL
    • September
      • Show/Hide via Checkbox and CSS
    • August
      • Javascript Nested Loop Break
    • July
      • CSS "nth-child" Processing
    • June
      • Client-Side Script After UpdatePanel Refresh
      • UpdatePanel Button Click via Javascript
      • ASP.NET Fire Validation
    • April
      • SQL Server CSV From Data
      • SQL Server Dynamic Script Permissions
    • March
      • Purpose of this blog
© 2025 Tom Hartland. All Rights Reserved