Developer tools

Persian URL decoder and encoder

Paste a link full of codes to read it, or turn a link or Persian text into codes. Everything happens in your browser.

This tool runs entirely inside your browser. No file or text is sent to any server.

How to use

  1. Type or paste the link, or the text you want to convert, in the top box. To just try the tool, press “Insert example”.
  2. When you put a link or text in the box, the tool works out which job is needed and switches on one of the two options at the top of the page: “Decode” if the text has codes, and “Encode” if it has Persian letters. If you choose one of the two options yourself first, the tool does only that job, and if the text needs the other one, a note under the box tells you.
  3. The result appears at once in the box below, with a line under it that says how many characters were read or turned into codes. If you have several links, put each on its own line and they are all converted together.
  4. If some codes were not opened when decoding, or the result still has codes, try the “Decode once more” button.
  5. Press “Copy” and take the result.

Notes on this tool

Every character that is not a plain letter or mark is written in a link as its bytes, each behind a percent sign: the Persian letter “ت” becomes %D8%AA. Decoding turns the bytes back into letters with UTF-8, which all current browsers use, and encoding turns a letter into its bytes. Nothing is translated or guessed.

A Persian domain name is written another way: “ایران” becomes xn--mgba3a4f16a. Decoding reads every part of a domain name that starts with xn--, and encoding writes a Persian domain name that way, as long as the link starts with http:// or https://.

When decoding, the codes of control characters, and of the characters that change the direction the text is written in, are not opened, because opened they would either be invisible or make the link read backwards. The code of a zero-width non-joiner (%E2%80%8C) is opened, but the character itself cannot be seen.

Decoding reads the text once, from left to right: %2541 becomes %41, not A. If a link was encoded twice, the tool notices and shows the button to decode again.

Encoding writes Persian letters, spaces and the marks that are not allowed in a link as their bytes; English letters and digits stay as they are. Codes that are already in the text are not encoded again, so encoding a link a second time changes nothing.

When encoding, each line counts as one link, and the marks that build the structure of a link, like the slash and the question mark, are left alone. To encode one word or sentence, turn on “This text is only a part of a link”.

The result of decoding is for reading and understanding a link: you see which page it goes to and which words are in it, and you can take its Persian words for a search or a quotation. To send a link to someone or to open it, use the original link; the readable one may not open in some programs, or may be cut in the middle. If you made a link readable and want to send it, encode it again.

Everything happens inside your browser and the link or text you enter is not sent anywhere.

Frequently asked questions

Why is a Persian link full of codes?
A link can hold only a few plain letters and marks. When you copy a link from the browser’s address bar or from some programs, every Persian letter is written as the code of its bytes so that it stays the same on every system. The browser shows them readable again in its own address bar, but the copied text is the codes.
Why were some codes not opened?
The tool reads codes as Unicode, the same table of characters that all browsers use today. If a link was made with another table, its codes are not opened; they stay as they are and their number is written under the result. An example is the links of some old Persian sites, which used a table called Windows-1256. Turn on “Read old codes too” to have the tool read those codes with that table. In texts made with this table, the Persian letters “ی” and “ک” are usually written in their Arabic forms; these look almost the same as the Persian ones but have different codes. To turn them into the Persian forms, use the Persian text cleaner tool.
What happens to a plus sign in a link?
In the search part of a link (after the question mark), a plus sign stands for a space, as in a search result link. By default the tool leaves it as it is, so that nothing changes without you asking. To turn it into a space, switch on “Read a plus sign as a space”. The code of a plus itself (%2B) is never turned into a space.
Why does the result still have codes?
If a link was made from another link, like a redirect link or a share link, it is sometimes encoded twice: the percent sign itself becomes a code too, and %D8 becomes %25D8. The tool decodes once and, if codes remain, shows the “Decode once more” button.
Why would I encode a link?
You do not always have to. But a link that has a space in it breaks in some programs: the program counts only what comes before the first space as the link and the rest is left outside. An encoded link has only plain letters and marks and is read the same way everywhere. Encoding also comes in handy when you want to put Persian text inside a link, for example the ready-made message of a WhatsApp link; for that job there is of course also the WhatsApp and Telegram link maker tool.
What is the difference between a whole link and a part of a link when encoding?
By default the text counts as a whole link, so marks like the slash and the question mark stay as they are, because they divide the link into its parts. If you are encoding just one word or sentence to put inside a link, turn on “This text is only a part of a link” so that those marks are encoded too; otherwise the meaning of the link changes. For example, if “a&b” is not encoded, the link sees it as two separate parts.

Related tools

QR code generator

Turn a link, phone number or any text into a QR code — in your browser, no internet needed.

Codes & data