I can't distinguish the difference in meaning between these two sentences.
It really doesn't matter.
It doesn't really matter.
It seems that there is a nuanced difference, but I cannot see what this is.
When the adverb really comes before a negated auxiliary, the effect is of emphasising the truth of the sentence:
Here the speaker is emphasising that they honestly are unable to detect any difference.
However, when really comes after the negated auxiliary, the effect is usually quite different. Instead of making the meaning of the sentence absolute, it has the effect of making the commitment vaguer:
Here the speaker means that they cannot tell the difference in an absolute way. This gives the impression that they actually can tell the difference a little bit, but not in a way that is important or significant.
The Original Poster's examples:
It really doesn't matter.
It doesn't really matter.
In example (1), the speaker is emphasising that it does not matter at all. The sentence has an emphatic flavour.
In example (2), the speaker is saying that it doesn't matter in a major or significant way. They are implying that maybe it matters a bit, but not to a significant or meaningful degree. Far from being emphatic in character, the second sentence is slightly vague, and may be perceived as off-hand.
What causes these differences is whether the adverb really is changing the meaning of the word not— or whether the word not is changing the meaning of really (technically, whether not scopes over really, or really scopes over not). It's a bit easier to see with a follow-on sentence:
- It really doesn't matter. Really not.
- It doesn't really matter. Not really.
Ultimately the word "really" means the same in both cases, of adding strength or emphasis.
If we swap "really" for "definitely" this becomes more clear: The first one is like
"It definitely doesn't matter" (I am sure that it doesn't: certainty)
and the second is like
"It does not definitely matter" (I am not sure that it does: uncertainty)
I think it helps a lot to break these two sentences down:
It really doesn't matter:The base sentence here is It doesn't matter. Really is an adverb which modifies doesn't. In this case, it puts emphasis on doesn't, meaning that it does not matter to a high degree.
It doesn't really matter:The base sentence here is It really matters. Doesn't modifies really by negating it.
So the difference between these two sentences is two-fold. The first is the difference between It really matters and It doesn't matter. The second is the difference between the modifiers doesn't and really.
It really matters means that something matters a lot, while it doesn't matter means it that something does not matter.
As an adverb, really puts emphasis on the verb it comes before. I want to eat ice cream means you just want to eat some ice cream, whereas I really want to eat ice cream means that you want to eat ice cream very much.
Doesn't, which is the same as does not, simply negates anything that it comes before. I want to eat ice cream vs I don't want to eat ice cream.
Putting these two things together, you can get a good sense of the differences between these two sentences.
When dealing with modifiers, it is crucial to understand what is being modified, and in English, this is typically determined positionally: modifiers tend to come directly before the thing being modified.
So here are the original sentences, adding arrows to indicate what's being modified by "really":
It (really -> doesn't) matter.1
It doesn't (really -> matter).
So the distinction is that the first sentence is emphasizing doesn't, while the second is emphasizing matter. Emphasizing that something doesn't matter simply reinforces how unimportant it is. By emphasizing matter, however, the second sentence becomes a statement of degree; it is about how much "it" matters.
This is because if something "really matters", it doesn't just matter; it matters more than something that merely "matters".
Thus, the second sentence is not indicating that "it" doesn't matter at all, it is merely indicating that "it" doesn't matter as much as something that "really matters".2
So in fact in the first sentence, "really" makes the sentence more emphatic overall, because it emphasizes that "it" doesn't matter at all, while the second sentence is ultimately less emphatic, since "it" might still matter somewhat. In order of increasing emphasis, i.e., a decreasing degree of perceived importance of "it":
In sentence #1, really modifies "doesn't matter".
In sentence #2, really modifies "matter".
Both can be seen as an answer to the wh-question "Does it matter?".
Sentence #1 means: it doesn't matter at all. The "doesn't matter" factor is more than the "matter" factor.
Sentence #2 means: it matters. It does matter. But doesn't matter that much. Doesn't matter a certain amount. Anything that matters at least that much (that "certain amount") or more is thought to really matter.
How much does it matter on a scale from 1 to 10?
"It doesn't really matter" means it can't be 10.
"It really doesn't matter" means it can't be 2 through 10. You could argue it couldn't even be 1.
"It really doesn't matter" - If I give you 4 quarters or a dollar bill.
"It doesn't really matter" - If I owe you $1.05 and only give you $1.