I want to use SVG icons which are licensed under CC BY 4.0 on my website. The CC BY 4.0 asks to give attribution. So, the question is do I give the attribution in the SVG code as "Icons provided by ... licensed under CC BY 4.0" or somewhere the user can see like the footer or the webpage? Also is the format "Icons provided by ..., licensed under CC BY 4.0" correct?
Fair disclosure: I'm not a lawyer.
I'd do both.
The way I understand the CC license(s), the point is to make it very clear where the images you're using come from. Most users won't look inside the SVG code, they'll just use your website, so having a footer that mentions the attribution is a good idea.
On the other hand, someone that will want to reuse those icons may very well download them and then in a later time use or modify them and not even remember where they came from, so adding the attribution inside the SVG code is also a good idea.
Since doing one doesn't prohibit doing the other, I'd just add the attribution in both places.
Also is the format "Icons provided by ..., licensed under CC BY 4.0" correct?
No. All CC licenses (other than public domain declarations like CC0), to my knowledge, require that you give a URL to the license, or the full license text. CC BY 4.0 does that in Section 3 a 1 C, where it says that you must:
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
"CC BY 4.0" is neither the text of the license, nor a URI or hyperlink to the license. You can make "CC BY 4.0" a clickable link to https://creativecommons.org/licenses/by/4.0/, then it is correct.