Does it make any difference in using

https://physics.meta.stackexchange.com/q/13855/305718

https://physics.meta.stackexchange.com/questions/13855/proper-formatting-of-links

? (Link is of this post as an example)

I've seen several times that the second one had been replaced by the first one.

There’s no difference for the person clicking the link, but there are minor differences for the person posting it, and for a hypothetical person who might read the URL but not click.

The magic number that’s common in your two examples, 13855, is the database identifier of your post. When you visit a link of the first form, your browser is redirected to a URL of the second form, with an appropriate #anchor to the middle of the page if the link is to an answer rather than to the question. You generate links of the first form by copying from the browser URL field.

You generate links of the second form by clicking the “Share” button under a post. The other number in the first form, here 305718, is the user ID of the person who has clicked that button – which you can verify by clicking on your profile name and looking at that URL. That user ID is used to award the Announcer, Booster, and Publicist badges. So if you’re motivated by badges and gamification, you might prefer to click the “Share” button instead of copying the URL.

A person who is reading the link, but not clicking, can divine the content of the question from the first form, because it includes a version of the title of the question. However, if the title of the question is edited, the old links will still work. The only valuable part of the long-form link is the question/answer ID; everything after that slash is ignored. That means that you can in principle deceive people about the content of the link with the long form: the URL https://physics.meta.stackexchange.com/questions/13855/im-a-big-dumb-poopy-head also redirects to this question, even though no one here is a big dumb poopy head.

A person who is reading the link, but not clicking, can determine your user account on the site from the short form. So if you were to send an email to your boss that said

hey this SO question solves our problem https://stackoverflow.com/a/952952/1650379

then your boss could, if motivated, visit your Stack Overflow profile page, notice from your list of linked accounts that you sometimes write long answers on Physics during so-called “working hours,” and give you grief about that. Someone who was more concerned about privacy than about Announcer badges might strip their user ID from the short-form links.

• Re "The only valuable part of the long-form link" -- value is always subjective ;-). The long-form text is valuable for people who are making a quick decision of the relevance of the link in order to click or not. Maybe "valuable" could be more accurately described as "navigation-active"? Sep 30 '21 at 15:49
• A decade into the RickRoll, I’m skeptical about decorations which can be added to links without actually changing where they go. Yes, it’s helpful to hover over a link whose URL includes text which might be a corruption of its current or previous title (no capital letters, no mathjax, no punctuation, a length limit, et cetera). But if you want to give the reader a hint, it’s better to do so in the highlighted link text, using the [highlighted link text](http://computer-garbage) syntax.
– rob Mod
Sep 30 '21 at 19:33

Presumably$$^1$$ not, but it is most safe to use the permalink format suggested when clicking the share button.

It sometimes makes a difference if the URL contains extra stuff (e.g. accidentally linking to a specific comment if the intent was to link to the question itself).

--

$$^1$$ The word presumably because SE presumably will make sure that links work in the future.

• I think they both qualify as permalinks; the difference is how many sections of the URL the server actually cares about. You are correct about the risk of stripping out a final #anchor referring to a specific comment.
– rob Mod
Sep 26 '21 at 18:33