SVG filter Element Last Updated : 31 Mar, 2022 Comments Improve Suggest changes Like Article Like Report The SVG <filter> element is used to define filters. To identify uniquely filter use id. The filters are defined in def elements. Syntax: <filter filterUnits="units to define filter effect region" primitiveUnits="units to define primitive filter subregion" x="x-axis co-ordinate" y="y-axis co-ordinate" width="length" height="length" filterRes="numbers for filter region" xlink:href="reference to another filter" > </filter> There are some filters provided by the SVG. Following is the list of the commonly used filters. feBlendfeColorMatrixfeComponentTransferfeCompositefeConvolveMatrixfeDiffuseLightingfeDisplacementMapfeFloodfeGaussianBlurfeImagefeMergefeMorphologyfeOffset - filter for drop shadowsfeSpecularLightingfeTilefeTurbulencefeDistantLightfePointLightfeSpotLight Attributes: filterUnits: units to define filter impact region. It specifies the coordinate system for the assorted length values inside the filter and for the attributes defining the filter subregion.primitiveUnits: units to define filter impact region. It specifies the coordinate system for the varied length values inside the filter and for the attributes defining the filter subregion.x: x-axis of filter bounding box.y: y-axis of filter bounding box.width: width of the bounding box.Height: height of the bounding box.filterRes: number of the filter region.xlink:href: refer to another filter. Example: html <html> <title>SVG Filter</title> <body> <svg width="400" height="400"> <defs> <filter id="filter2" x="0" y="0" width="150%" height="150%"> <feOffset result="offOut" dx="30" dy="30" /> <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" /> <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> </filter> </defs> <g> <rect x="50" y="50" width="150" height="150" fill="gray" filter="url(#filter2)" /> </g> </svg> </body> </html> Output: Example: Different shape and customize shadow. html <html> <title>SVG Filter</title> <body> <svg width="400" height="400"> <defs> <filter id="filter2" x="0" y="0" width="150%" height="150%"> <feOffset result="offOut" dx="30" dy="30" /> <feBlend in="SourceGraphic" in2="blurOut" mode="normal" /> </filter> </defs> <g> <circle cx="80" cy="80" r="50" stroke="black" stroke-width="2" fill="green" filter="url(#filter2)" /> </g> </svg> </body> </html> Output: Create Quiz Comment V Vijay Sirra Follow 0 Improve V Vijay Sirra Follow 0 Improve Article Tags : Web Technologies HTML HTML-SVG SVG-Element Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like