# Area of a Hexagon

A hexagon is a 6-sided, 2-dimensional geometric figure. The total of the internal angles of any hexagon is 720°. A regular hexagon has 6 rotational symmetries and 6 reflection symmetries. All internal angles are 120 degrees.

**Examples :**

Input: 4 Output: 41.5692 Input: 6 Output: 93.5307

Number of vertices: 6

Number of edges: 6

Internal angle: 120°

Area = (3 √3(n)^{2}) / 2

**How does the formula work?** There are mainly 6 equilateral triangles of side n and area of an equilateral triangle is (sqrt(3)/4) * n * n. Since in hexagon, there are total 6 equilateral triangles with side n, are of the hexagon becomes (3*sqrt(3)/2) * n * n

## C++

`// CPP program to find ` `// area of a Hexagon ` `#include <iostream> ` `#include <math.h> ` `using` `namespace` `std; ` ` ` `// function for calculating ` `// area of the hexagon. ` `double` `hexagonArea(` `double` `s) ` `{ ` ` ` `return` `((3 * ` `sqrt` `(3) * ` ` ` `(s * s)) / 2); ` `} ` ` ` `// Driver Code ` `int` `main() ` `{ ` ` ` `// Length of a side ` ` ` `double` `s = 4; ` ` ` `cout << ` `"Area : "` ` ` `<< hexagonArea(s); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`class` `GFG ` `{ ` ` ` `// Create a function for calculating ` ` ` `// the area of the hexagon. ` ` ` `public` `static` `double` `hexagonArea(` `double` `s) ` ` ` `{ ` ` ` `return` `((` `3` `* Math.sqrt(` `3` `) * ` ` ` `(s * s)) / ` `2` `); ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `// Length of a side ` ` ` `double` `s = ` `4` `; ` ` ` `System.out.print(` `"Area: "` `+ ` ` ` `hexagonArea(s) ); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to find ` `# area of a Hexagon ` `import` `math ` ` ` `# Function for calculating ` `# area of the hexagon. ` `def` `hexagonArea(s): ` ` ` ` ` `return` `((` `3` `*` `math.sqrt(` `3` `) ` `*` ` ` `(s ` `*` `s)) ` `/` `2` `); ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `"__main__"` `: ` ` ` ` ` `# length of a side. ` ` ` `s ` `=` `4` ` ` ` ` `print` `(` `"Area:"` `,` `"{0:.4f}"` `. ` ` ` `format` `(hexagonArea(s))) ` ` ` `# This code is contributed by Naman_Garg ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find ` `// area of a Hexagon ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` ` ` `// Create a function for calculating ` ` ` `// the area of the hexagon. ` ` ` `public` `static` `double` `hexagonArea(` `double` `s) ` ` ` `{ ` ` ` `return` `((3 * Math.Sqrt(3) * ` ` ` `(s * s)) / 2); ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `// Length of a side ` ` ` `double` `s = 4; ` ` ` ` ` `Console.WriteLine(` `"Area: "` `+ ` ` ` `hexagonArea(s) ); ` ` ` `} ` `} ` ` ` `// This code is contributed by vt_m. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find ` `// area of a Hexagon ` ` ` `// function for calculating ` `// area of the hexagon. ` `function` `hexagonArea( ` `$s` `) ` `{ ` ` ` `return` `((3 * sqrt(3) * ` ` ` `(` `$s` `* ` `$s` `)) / 2); ` `} ` ` ` `// Driver Code ` ` ` `// Length of a side ` `$s` `= 4; ` `echo` `(` `"Area : "` `); ` `echo` `(hexagonArea(` `$s` `)); ` ` ` `// This code is contributed by vt_m. ` `?> ` |

*chevron_right*

*filter_none*

**Output :**

Area: 41.5692

## Recommended Posts:

- Area of hexagon with given diagonal length
- Area of a circle inscribed in a regular hexagon
- Area of the Largest Triangle inscribed in a Hexagon
- Diagonal of a Regular Hexagon
- Largest hexagon that can be inscribed within a square
- Largest Square that can be inscribed within a hexagon
- Find length of Diagonal of Hexagon
- Largest hexagon that can be inscribed within an equilateral triangle
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon
- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Area of Reuleaux Triangle
- Area of a Regular Pentagram
- Area of plot remaining at the end

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.