<ellipse>
Core element
Place <ellipse> inside an <svg> canvas to draw an oval.

SVG’s <ellipse> draws an oval from a center point and two radii — horizontal (rx) and vertical (ry). This tutorial covers positioning, sizing, styling with fill / stroke, responsive viewBox usage, five worked examples, and how <ellipse> compares to <circle> and other basic shapes.
Core element
Place <ellipse> inside an <svg> canvas to draw an oval.
Center point
Set the horizontal and vertical position of the ellipse’s center.
Two radii
rx is half-width; ry is half-height — differ them for an oval.
Presentation
Color the inside and outline with fill, stroke, and stroke-width.
Responsive
Scale ellipses cleanly with a viewBox and CSS sizing.
When to switch
Use <circle> when radii are equal; use <ellipse> when they differ.
SVG’s <ellipse> is the stretched cousin of <circle>. Instead of one radius, you set horizontal and vertical radii so the shape can be wide, tall, or perfectly round when both match.
Ellipses appear in icons, diagrams, chart markers, soft UI blobs, and decorative backgrounds. Once you know cx, cy, rx, ry, and a few presentation attributes, most oval graphics are a few lines of markup.
Bitmap ovals blur when scaled. SVG ellipses stay sharp, stay small in file size, and can be styled or animated with CSS and JavaScript like any other DOM element.
cx, cy, rx, and ry fully define geometry.
Fill, stroke, opacity, and dashes work as attributes or CSS.
Add role="img" and an aria-label when the ellipse conveys meaning.
One drawing scales to any CSS size without rewriting coordinates.
In short: put an <ellipse> in an <svg>, set the center and two radii, then style the fill and stroke — that’s the whole foundation.
Basic form of the SVG ellipse element:
<svg width="200" height="150">
<ellipse cx="100" cy="75" rx="80" ry="50" />
</svg> | Attribute | Type | Description |
|---|---|---|
cx | Length / number | x-coordinate of the center. Defaults to 0. |
cy | Length / number | y-coordinate of the center. Defaults to 0. |
rx | Length / number | Horizontal radius (half-width). Defaults to 0. |
ry | Length / number | Vertical radius (half-height). Defaults to 0. |
fill | Paint | Interior color (or none for outline-only). |
stroke | Paint | Outline color of the ellipse. |
stroke-width | Length / number | Outline thickness in user units. |
| Result | Details |
|---|---|
| vector ellipse | Renders an oval (or a circle when rx === ry) using the center and two radii you provide. |
<svg width="200" height="150" viewBox="0 0 200 150">
<ellipse cx="100" cy="75" rx="80" ry="50"
fill="green" stroke="black" stroke-width="2" />
</svg> | Idea | Detail | Notes |
|---|---|---|
| Origin | (0, 0) is top-left | y grows downward |
| Keep it visible | cx ± rx and cy ± ry | Stay inside width/height or viewBox |
| Missing radii | rx / ry default to 0 | Nothing is drawn |
| Goal | Code |
|---|---|
| Basic ellipse | <ellipse cx="100" cy="75" rx="80" ry="50" /> |
| Wide oval | rx="60" ry="25" |
| Tall oval | rx="25" ry="55" |
| Stroke only | fill="none" stroke="#b45309" stroke-width="3" |
| Looks like a circle | rx="40" ry="40" (or prefer <circle>) |
| Responsive SVG | <svg viewBox="0 0 200 150">... + CSS width |
<ellipse> vs <circle> vs <rect> vs <path>All draw shapes — pick the simplest element that fits.
two radiiOvals with cx, cy, rx, ry
one radiusPerfect round shape with a single r
boxRectangles and rounded squares
any shapeArcs and custom outlines when primitives aren’t enough
<ellipse>Reach for <ellipse> whenever width and height of the round shape should differ.
Buttons, badges, and soft blobs that aren’t perfect circles.
Node shapes, orbit paths, and stretched scatter markers.
Brand marks and illustrations built from layered ovals.
Decorative ellipses behind cards and hero sections.
If rx equals ry, prefer <circle> for clearer intent.
Key benefit: independent horizontal and vertical radii — the simplest oval in SVG.
Five starter snippets using <ellipse>. Click View Output for a preview, or Try It Yourself to edit live.
Draw your first ellipse and vary the radii.
Draw a green ellipse with a black border, centered at (100, 75) with rx=80 and ry=50.
<svg width="200" height="150">
<ellipse cx="100" cy="75" rx="80" ry="50"
fill="green" stroke="black" stroke-width="2" />
</svg> The SVG is 200×150. The center sits in the middle, and the larger rx stretches the shape horizontally while ry keeps it shorter vertically.
Compare a wide oval (rx > ry) with a tall oval (ry > rx) side by side.
<svg width="240" height="120">
<ellipse cx="70" cy="60" rx="55" ry="22" fill="#3b82f6" />
<ellipse cx="180" cy="60" rx="22" ry="50" fill="#10b981" />
</svg> Changing only rx and ry flips the aspect ratio. The same center API as a circle — but two size knobs instead of one.
Outline styles, dashes, and responsive sizing.
Set fill="none" so only the outline appears — useful for rings and frames.
<svg width="200" height="120">
<ellipse cx="100" cy="60" rx="70" ry="40"
fill="none" stroke="#b45309" stroke-width="4" />
</svg> With no fill, the browser draws only the elliptical path. Without a stroke, a fill="none" ellipse would be invisible.
Combine stroke-dasharray and fill-opacity for softer, decorative ellipses.
<svg width="240" height="100">
<ellipse cx="70" cy="50" rx="55" ry="30"
fill="#ef4444" fill-opacity="0.35"
stroke="#991b1b" stroke-width="2" />
<ellipse cx="175" cy="50" rx="55" ry="30"
fill="none" stroke="#6d28d9" stroke-width="3"
stroke-dasharray="6 4" />
</svg> fill-opacity fades the fill without changing the stroke. stroke-dasharray="6 4" draws dashed outlines around the ellipse.
Define coordinates in a viewBox, then let CSS control the displayed size so the ellipse scales cleanly.
<style>
.badge { width: 120px; height: auto; display: block; }
</style>
<svg class="badge" viewBox="0 0 100 60"
role="img" aria-label="Blue oval badge">
<ellipse cx="50" cy="30" rx="42" ry="22" fill="#3b82f6" />
</svg> The viewBox maps user units to whatever CSS size you give the SVG. Change .badge { width } and the ellipse scales without rewriting cx, cy, rx, or ry.
Real-world places where SVG ellipses show up every day.
Background blobs, pill highlights, and decorative ovals.
Example: hero accent behind a headline.
Stretched markers, orbit diagrams, and oval nodes.
Example: category bubbles on a chart.
Face outlines, speech bubbles, and badge frames.
Example: oval avatar clip backgrounds.
Brand marks built from one or more layered ellipses.
Example: concentric ovals as a wordmark icon.
Animated dashes along an elliptical path.
Example: orbiting progress ring.
Geometry lessons contrasting circles and ellipses.
Example: interactive rx / ry demos.
Pro Tip: if rx and ry are always equal, switch to <circle> — the markup reads clearer and stays shorter.
Why draw ellipses with SVG instead of images or CSS alone.
Control width and height separately without transforms.
Vectors stay sharp on any screen density.
A few attributes replace PNG downloads for simple ovals.
Style, animate, and update ellipses like any other DOM node.
Meaningful graphics can expose purpose via aria-label or <title>.
Pro Tip: animate rx / ry for morphing blobs — often simpler than warping a circle with transforms.
Follow these practices for clean, scalable SVG ellipses.
Define geometry once, then size the SVG with CSS.
Thick strokes can clip at the SVG edge — pad the canvas or shrink radii.
fill="currentColor" inherits the parent text color for easy theming.
If both radii stay equal, <circle> documents intent better.
Add role="img" and aria-label when the ellipse is not decorative.
Pro Tip: decorative ellipses can use aria-hidden="true"; informative ones should explain themselves to assistive tech.
Avoid these mistakes when your ellipse refuses to show up.
rx or ryEither radius defaults to 0, so the ellipse is invisible until both are set.
→ Always set positive rx and ry (and a fill or stroke).
fill="none" With No StrokeNothing paints — outline-only ellipses need a visible stroke.
→ Pair fill="none" with stroke and stroke-width.
If cx + rx or cy + ry exceeds the SVG size, parts get clipped.
→ Keep the full oval inside the drawing area, including stroke.
Missing width/height and no CSS size leaves an empty box.
→ Set dimensions on the SVG or size it with CSS.
Equal radii work, but <circle> is clearer and shorter.
→ Prefer <circle r="..."> when both radii match.
Pro Tip: if an ellipse vanishes, check both radii, fill/stroke, and whether the center sits inside the viewBox — those catch most issues.
<ellipse> Is DrawnWrap your shape in an <svg>. Give it a width and height (or a viewBox) so the browser knows the drawing area.
cx is horizontal position; cy is vertical. Origin (0, 0) is the top-left corner.
rx is half the width; ry is half the height. Both must be greater than zero or nothing draws.
Use fill for the inside, stroke for the outline, and stroke-width for thickness. Set fill="none" for outline-only.
The browser draws the vector live from center, radii, and paint values — sharp at every zoom level.
rx and ry default to 0 — always set both to positive values.stroke-width sits outside the radii and can clip near edges.<circle> for clearer intent.viewBox when the graphic must scale responsively.Quick Takeaway: center + two radii + paint. Keep the oval inside the viewBox, and use CSS sizing for responsive icons.
The SVG <ellipse> element is supported in all modern browsers — and has been for many years — as part of SVG 1.1 basic shapes.
Use
Bottom line: Safe for production sites. Prefer inline SVG or cached .svg assets; no polyfill is required for current browsers.
SVG <ellipse> is the simplest way to draw ovals on the web: set cx, cy, rx, and ry, then style with fill and stroke.
Practice the five examples above, then continue to SVG Line to draw straight segments between two points.
Always set positive rx and ry, leave room for strokes, and prefer <circle> when both radii are equal.
viewBox on the parent <svg> for responsive scalingrole="img" and aria-label for meaningful graphicscurrentColor for themingcx ± rx and cy ± ry inside the canvas(0, 0) is the top-left cornerfill="none" without a strokerx or ry — both default to 0<ellipse>Draw ovals the SVG way.
Basic SVG shape
APIcx & cy
Positionrx & ry
Sizefill & stroke
StyleScales cleanly
ResponsiveAn SVG <ellipse> is defined by a center (cx, cy) and two radii (rx, ry) — when those radii differ, you get an oval instead of a circle. You can also rotate an ellipse with transform="rotate(...)" when you need a tilted oval without changing the radii.
Learn how x1, y1, x2, and y2 draw straight vector lines.
9 people found this page helpful