Is there a difference in sound between a coax cable and an optical one?

I've had 2 separate DACS within the past 20 years, both using a coax cable.  I've had trouble with both with the connections.  They either come loose or disconnect or whatever.  I've always had to go and wiggle the cable to get the sound to come out again.  The older one was an Audioquest cable (long gone) and the one I'm using now is an MIT (probably 12-15 years old).   My plans are to get a new pre-amp with a built-in DAC and if there is no substantial difference in sound, I plan on using an optical cable this time around.   Any thoughts?
Need to be careful with optical not to bend it to severe. As far as sound I have never noticed a difference between them though with some DACs optical doesn't do as high a resolution as coax not sure that's still the case, check your manual. 
How thick/heavy/stiff is your coax cable.  On heavier and stiffer cables, it puts stress on the RCA jack itself.  What happens is it bends the internal contact as the weight or stiffness of the coax cable applies tension.  At some point, the internal contact of the RCA jack becomes "out of bounds" and a standard RCA cable inserted will not make contact.
Jones:  Yeah, I'm using optical cables from my TVs to their soundbars, being very careful not to bend at all. Thanks for the reminder. 

Aux:  I think what you're saying is spot on.  I'll check behind the components and see what's going on.   I did notice on both occasions that this happened over some time.  Maybe it's just time for some new cables. 
Thank you both. 
In terms of my Benchmark DAC3,  the manufacturer indicates that its optical inputs are not recommended for DSD or for sample rates above 96 kHz. They cite that optical connections may be unreliable at sample rates above 96 kHz.  For this reason alone I use COAX on my DAC3 and not optical. 
It's not the RCA cable that's a problem.  It's the RCA jack on the DAC.  On many RCA jacks inside, there is a pressure plate which the pin/tip of the RCA plug touches to make contact.  Over time, if there is tension on the cable, it will bend this pressure plate away and eventually there will not be contact between the pressure plate and the RCA tip.  You really won't be able to see this just be looking behind the components.  It is actually inside the RCA jack.
You could always support the rca with a small piece of foam or other neutral material so that the rca stays level with the input.🙂
Tom:  I like that idea.    I'll have to do something.  It's annoying to not get any sound out after you set yourself up with the music and some "suck down" and then..... ZEEEEERO.  Now i have to get up and wiggle and jiggle the cable.  Thanks!
shtinkydog, nobody can answer that, since it is system dependent.  Optical should be better, because it does nor create ground loops and is not sensitive to any electrical ambient noise, but on it is very susceptible to a system noise. System noise, on either makes threshold point variable - not only in amplitude but also in time.  Uncertainty in time is jitter.  Jitter is noise. Going to coax helps, because transitions are 10x faster, but fast transitions create standing waves in the cable (reflections) that alter timing.  Nobody can tell you what is better.  They can tell you only what worked better in THEIR SYSTEM.  You have to try for yourself.
In theory, optical is better as there can be no chance of ground loops. Ground loops CAN manifest in the digital and analog domains.

In the first, it can produce significantly more jitter, and was for a time a significant source of issues with PC/laptop based systems when powered from the AC. Batter power and better isolation seem to have taken care of most of this, same for USB.

There has been some claims that the receivers just tend to be better for coaxial, but also conflicting claims that coaxial receivers are often not optimized for S/PDIF.

In any event, I use USB for it all now. Sounds good, and much higher bandwidth.
Good point, @three_easy_payments

I had forgotten about the bandwidth differences.


There are soooo many variables. Coax output, cable, and input implementation etc. Same with optical variables. Do experiment with what you can and use what sounds best to you.

In my own rig after trying 3 coax (silnote, HF Reveal & Acoustic Revive DSIX active) and 2 optical cables (both plastic & glass), on both types both with and without an ifi spdif ipurifier, coax bested optical for both music and video. Since my DAC uses no muting, using the ifi caused a loud zap every time I switched sources (node2) so I left it off. The active AR coax cable sounds most musical and real to me on everything. Good luck!
Just to add to stray-cat‘s comment: AR DSIX is fantastic and can be further improved by adding a LPS such as Kingrex. I kid you not, even the power cable feeding the Kingrex makes a difference
In theory, the coax should be better due to higher bandwidth and less jitter. In my case, the optical sounded better/smoother. An unfair contest, however, as I was using Lifatec glass optical and cheap BJC coax. If better coax comes my way, I may repeat the comparison but I'm in no rush.