Home > Excel > Understanding Encoded URLs

Understanding Encoded URLs

The last post I wrote was explaining how to encode or unencode a URL using a simple replace function in Excel, and in this post I want to explain “why” URLs need to be encoded in the first place. I also want to say that I’m not the most technical marketer out there — so this is my understanding behind when and why we encode our URLs.

Why do some characters or symbols need to be encoded?

URLs need their characters to be in a specific format, ASCII characters, so that browsers can correctly interpret and parse the data. There is a set of characters that have special meaning, ? = & # % =, these characters need to encoded if they are being used for any purpose other than what they are supposed to be used for.

I’ve been dealing with double and triple encoding of URLs because my marketing campaigns use one for attribution tracking across marketing channels, one for the historical bid optimization platform, and a third redirect from the new bid optimization platform that we are migrating toward. In most cases you shouldn’t use three back to back redirects because it leaves a lot of room for breaking between the initial redirect and the destination page loading. I’m having to do multiple levels of encoding so I don’t loose the tracking codes that are being passed and appended to the destination URL.

The examples I’m using below in this post are combinations of the Adlucent, Kenshoo and Mediaplex redirect URLs.

What does a redirect URL look like?

An unencoded URL with two redirects, one for the paid search marketing agency (in this example: ThirdPartyCompany) and one for an attribution vendor/third party software to cookie all marketing traffic (in this example: Other.TrackingPixel) might look something like this:


In the URL above you would want to encode all characters and symbols starting with the second ? within the URL. The encoding would look like this:


If I were to triple encode a URL, i.e. add a third redirect, it would still need to happen starting at the second ? within the URL set, but it also means that the % symbol for the first round of encoded URLs would be encoded to %25. So a double encoded ampersand (&) would be a 4 digit numerical string represented as %2524. %24 is the ampersand, but then you’d have to encode the % which is %25, add it together and you get %2425.

So have I completely lost you yet? If yes, my apologies. Please ask questions!

Below are a few good references for the purposes of characters in a URL string and the common ASCII encoded values for core characters/symbols.

So what is the Purpose of a specific character in the URL?

Character Purpose in URL Encoding

: Separate protocol (http) from address %3B
/ Separate domain and directories %2F
# Separate anchors %23
? Separate query string %3F
& Separate query elements %24
@ Separate username and password from domain %40
% Indicates an encoded character %25
+ Indicates a space %2B
~ Indicates a user directory %&E

ASCII Character URL-encoding

space %20
! %21
” %22
# %23
$ %24
% %25
& %26
‘ %27
( %28
) %29
* %2A
+ %2B
, %2C
– %2D
. %2E
/ %2F
: %3A
; %3B
? %3F
@ %40
[ %5B
\ %5C
] %5D
^ %5E
_ %5F
` %60
{ %7B
} %7D

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: