Rectangle Tool

Inkscape’s Rectangle tool can draw rectangles or squares. It can also create them with rounded corners.

Animation drawing a rectangle, adjust handles

Draw a rectangle

To create a rectangle:

  • Select the Rectangle Tool from the Toolbox (keyboard shortcuts R or F4).

  • Hold the primary mouse button and Drag the mouse diagonally over the canvas until the desired size/shape is achieved, then release the mouse button.

While dragging, hold these modifier keys to constrain the rectangle:

  • Hold CtrlCmd while dragging to constrain the rectangle to set ratios, such as 1:1 (square), 1:1.618 (Golden Ratio), 1:2, 2:1 and so on.

  • Hold Shift while dragging to create the rectangle around the point where you held the Left Mouse Button.

  • Hold ShiftCtrlCmd Performs the behavior of both Ctrl and Shift at the same time.

By default, the rectangle will use the current style, the last style used by this tool or other tools. Modify the color by:

Once a style is applied to an object, it will become the new current style.

Modify a rectangle with the mouse

When the Rectangle tool is active, clicking on a rectangle will show the modification handles.

Note

The handles will also be present when selecting the rectangle with other shape tools or the Node tool active.

screenshot rectangle with modification handles

Moving the square handles change the size of the rectangle.

  • Hold CtrlCmd while dragging the square handles diagonally to lock the width/height ratio.

  • Hold CtrlCmd while dragging horizontally or vertically to stretch the rectangle in that direction.

The two circle handles allow adjusting the curvature of the corners. When there is no radius applied, the handles overlap each other.

screenshot rectangle with circle modification handles
  • The circle handle on top adjusts the vertical radius (Ry). When both handles are overlapping, dragging it reveals the second circle handle. The underlying circle handle adjusts the horizontal radius (Rx).

  • While the horizontal radius is 0, dragging the vertical radius handle produces evenly sized round corners.

Tip

There are two ways to make the corners round. One is by setting either radius (Rx or Ry) to 0 while the other has a positive value. The other is by setting the radii to the same value by entering the values either in the Rectangle tool controls bar, or CtrlCmddrag one of the handles.

See also

The corner radii set via this method applies to all 4 corners. To set different corner radii on individual corners, see Corners LPE.

Modify a rectangle with the keyboard

You can also adjust the rectangle size and radii with the arrow keys. First, click on a handle to select it. Selected handles appear in the handle accent color. After that, use the arrow keys to modify the handle value.

Todo

link to handle accent color in the preferences

Combine arrow key presses with the following modifiers:

  • AltOption arrow for small adjustments. Zoom in for finer adjustments.

  • Shift arrow for large adjustments.

See also

For more detail on using the AltOption and Shift modifiers, see Transformations Section.

Warning

Adjustments made with the arrow keys fail to update the XML file and the Width/Height entries in the Tool Controls bar.

Work arounds:

  1. Deselect the Rectangle and then re-select. The W/H entry boxes will update. Now click in one of these boxes and press EnterReturn. This will update the XML.

  2. Change to Selection tool and move the Rectangle one arrow key press out, and then one back again. The W/H entry boxes and XML are updated.

With a rectangle selected

  • The [ or ] keys will rotate the rectangle in 15° steps.

  • The < (,) or > (.) keys will shrink/enlarge the rectangle (See Transforms with keyboard ).

Note

With multiple objects selected, the keys will rotate and resize the selected objects around the center of the selection area.

Tool controls bar

Rectangle tool Controls bar
  • Width: the rectangle’s width in the user’s chosen units

  • Height: the rectangle’s height in the user’s chosen units

  • Corner radius Rx: horizontal curvature of corners

  • Corner radius Ry: vertical curvature of corners

  • Units: select from in, pt, pc, cm, m, mm, ft, px (See Inkscape Units )

  • Sharp Corners icon : restore rectangle’s corners to sharp angle corners

Entry box arithmetic (+ add, - subtract , * multiply , / divide) is possible, computation progresses from left to right.

Todo

Inkscape units link

With the Selection tool enabled

The rectangle can be modified using the transformation handles. (See Transformation handles )

With the Node tool and other shape tools enabled

The same modification handles are available on a selected rectangle, as if the Rectangle tool was enabled. You can even adjust the ellipse modification handles with these other tools.

Note

When multiple shape objects are selected only the Node tool will display the modification handles.

Adjustments with Object Properties dialog

Todo

revisit this part at a later point when the Object Properties chapter is done.

Modify or view a rectangle with XML Editor

Example Rectangle

Name

Value

units in mm (millimetres)

rx

1.0034755

curved corner radii

ry

1.0034755

y

20.872311

Canvas position of rectangles’ upper right corner

x

104.01035

height

5.0675583

Size of rectangle sides

width

7.0745101

id

rect4

style

fill:#54fc00;—-

CSS style properties

Todo

See also

Examples{link} using rectangle tool

  • As a frame

  • As a background

  • Square as a circle

  • A building

  • A silhouette oceanliner